couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hank Knight <hknight...@gmail.com>
Subject CouchDB: Using XMLHttpRequest in Show Functions
Date Mon, 20 Jan 2014 16:29:54 GMT
I discovered that new functions can be made available to all show and
list functions by modifying:
/share/couchdb/server/main.js

I have attached an example.  To test it, replace your version of
"main.js" with the one I attached.

Then create a design document like the one I attached.

Test it like this:
http://localhost/db/_design/showtell/_show/test

This causes the custom function in main.js to be executed and it
returns a result.

I want to use this method to retrieve data, like this:

function getPage(url) {
 var req = new XMLHttpRequest();
 req.open("GET", url, false);
 req.send(null);
 return(req.responseText);
}

Everything works until I use XMLHttpRequest.  Then I get an error:
XMLHttpRequest is not defined

How can I gain access to XMLHttpRequest from main.js?

Mime
View raw message