couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From whimsica <>
Subject get emit(,doc.url) to javascript variable
Date Tue, 10 Aug 2010 00:50:56 GMT

So far I'm very confused about how to get couchdb to talk to javascript on
the web page using show or view.

Let's say I have a database with things like names of users and a url that
users submit
I want to emit the results of a view in raw json form and alert it on the
page using javascript alert()

How do I do that.

I tried putting a javascript function in a view (alert(1)) just to see but
it gave back an error.

So far I was able to call a javascript function in a show command below but
it's not the json from the view.

   "_id": "81c76a15131be24115f53e2cafaea4e8",
   "_rev": "2-5df7ac370489e818b4e72d5293069bfb",
   "name": "moe",
   "url": ""

   "_id": "_design/yo",
   "_rev": "11-3ac3428c8d47bb485b67f262248c8192",
   "language": "javascript",
   "views": {
       "users": {
           "map": "function(doc) {emit(,doc.url)}"
   "shows": {
       "showall": "function(doc,req){return <script>alert(1)</script>}"

Thank you,


View this message in context:
Sent from the CouchDB Development mailing list archive at

View raw message