incubator-couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Freddy Bowen <frederick.bo...@gmail.com>
Subject Re: get emit(doc.name,doc.url) to javascript variable
Date Fri, 13 Aug 2010 13:17:43 GMT
Return a string:

"shows": {
    "showall": "function(doc,req){return '<script>alert(1)</script>';}"
}

FB

On Mon, Aug 9, 2010 at 8:50 PM, whimsica <whimsica@aol.com> wrote:

>
> 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.
>
> database
> {
>   "_id": "81c76a15131be24115f53e2cafaea4e8",
>   "_rev": "2-5df7ac370489e818b4e72d5293069bfb",
>   "name": "moe",
>   "url": "http://www.moeshomepage.com"
> }
>
>
> {
>   "_id": "_design/yo",
>   "_rev": "11-3ac3428c8d47bb485b67f262248c8192",
>   "language": "javascript",
>   "views": {
>       "users": {
>           "map": "function(doc) {emit(doc.name,doc.url)}"
>       }
>   },
>   "shows": {
>       "showall": "function(doc,req){return <script>alert(1)</script>}"
>   }
> }
>
> Thank you,
>
> Dan
>
> --
> View this message in context:
> http://couchdb-development.1959287.n2.nabble.com/get-emit-doc-name-doc-url-to-javascript-variable-tp5391246p5391246.html
> Sent from the CouchDB Development mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message