OK -- I figured out the problem. You both were right - the headers was NOT the issue.
The problem was that I was fighting a cross domain problem. I moved all of the code to the apache2 server in an Ubuntu VM I was using Rivet in and THAT seemed to do the trick. Setting up Apache2 with a Virtual Server was not a trivial thing... finally found a good article on how to do this quickly. After I got all of that configured correctly -- it worked perfectly... I think the cross domain request was a bigger problem than I realized at the time. I was doing a file based view of my HTML, calling the Rivet server.... no go... Moved to the Rivet Server... ALL OK! (basics always burn me it seems). Now I can roll up the sleeves and play. THANKS for your quick response(s). Dave On Fri, Apr 5, 2013 at 4:09 AM, Massimo Manghi <massimo.man...@unipr.it>wrote: > > Hello David > > > On Fri, Apr 05, 2013 at 12:19:14AM -0400, David Bigelow wrote: > > Ok - I am soooooooo close to figuring this out... But I am stumped. > > > > I have a simple service that reads data from a database and generates > JSON > > so an AJAX request can query it. All looks good except for ONE THING. > > > > Rivet appears to be automatically adding HTML and BODY tags around my > > content: > > > > <html> > > <head></head> > > <body> > > > <pre>{"results":[{"optionValue":1,"optionDisplay":"Automotive"},{"optionValue":2,"optionDisplay":"Generator > > > Drive"},{"optionValue":3,"optionDisplay":"Industrial"},{"optionValue":4,"optionDisplay":"Marine"}]} > > </pre> > > </body> > > </html> > > > > if you're generating a JSON message within an rvt template it will > certainly send to the client the whole > HTML pattern in the file. There is no way to suppress this output if a > template is shipping HTML (which is > the purpose for having templates after all) > > Please would you try to put your message in a sample .tcl script? > Something like > > json.tcl: > > headers type "application/json" > > puts -nonewline > "{\"results\":\[{\"optionValue\":1,\"optionDisplay\":\"Automotive\"}," > puts -nonewline "{\"optionValue\":2,\"optionDisplay\":\"GeneratorDrive\"}," > puts -nonewline "{\"optionValue\":3,\"optionDisplay\":\"Industrial\"}," > puts "{\"optionValue\":4,\"optionDisplay\":"Marine\"}\]}" > > ----------- > > just that. It works for me. > > > > I DON'T want the HTML tags -- I just need the JSON to be supplied like > this: > > > > > > {"results":[{"optionValue":1,"optionDisplay":"Automotive"},{"optionValue":2,"optionDisplay":"Generator > > > Drive"},{"optionValue":3,"optionDisplay":"Industrial"},{"optionValue":4,"optionDisplay":"Marine"}]} > > > > > > I have even tried to force the header content type to be > "application/json" > > -- and I STILL get the HTML/BODY tags around my content. > > > > Is there ANY way to prevent Rivet from doing this?! > > > > Eagerly awaiting feedback. (BTW -- this is pretty AWESOME so far....) > > > > > > -- Massimo > -- David Bigelow Simplified Logic, Inc. C: 317-431-5454