On 10 August 2010 19:06, <whims...@aol.com> wrote: > > How can I get a view into a javascript variable on an html page? > I have a web based json viewer but I need to get the view json out > of couchdb and into a javascript variable on the webpage to make it work. > > Thanks, > > Dan > > I can't figure out how to do this from the documentation or hours of browsing > around and reading the two couchdb books.
Well I am a crap javascript programmer (think duplo building blocks) but this works for me - is this what you were missing? <script type="text/javascript"> $.getJSON("/mydb/d...@example.org", function(json){ alert(json.name + " lives in " + json.location + " and you can fax to " + json.fax); }); </script> & the doc on the couch: { "_id": "d...@example.org", "type": "contact", "site": "NZL.Wellington", "phone": "+64 4 9727208", "fax": "+64 4 9727123", "name": "Dave Cottlehuber" } It should be the same for a view, your URL will be different. cheers Dave