Hi Mike, you have to specifically enable JSONP. See the "Configuration" pane in Futon.
There are minimal API docs for couch.js and jquery.couch.js here: http://www.couchone.com/page/library-couch-js http://www.couchone.com/page/library-jquery-couch-js Cheers Jan -- On 31 Jan 2011, at 00:41, mike wrote: > I just started exploring couchDB and ran into this problem. I am trying to > access some stuff on my newly created couchone.com database. I just want to > learn how to fetch the names of the databases I have created using an ajax > call from a client browser running on a local pc. > > Using jQuery (in Firexox) in the firebug command window I run this: > > test = function(){ > url = "http://withforesight.couchone.com/_all_dbs"; > $.ajax({ > url: url, > dataType: 'jsonp', > success: ( function(Response){ console.log(26, 'response is: ', > Response) } ), > error: function(XMLHttpRequest, textStatus, errorThrown){alert("Error"); } > }); > > }; > test() > > I receive the following reply from the server: > HTTP/1.1 200 OK > Server: CouchDB/1.0.2 (Erlang OTP/R14B) > Date: Sun, 30 Jan 2011 22:52:29 GMT > Content-Type: text/plain;charset=utf-8 > Content-Length: 55 > Cache-Control: must-revalidate > > In all cases I see a status code of 200OK. (note odd content type). > > However: > (1) the success handler DOES NOT trigger. Nothing appears in the console > log. > (2) In the NET tab I see the data has been returned both in JSON format and > as an array (under the RESPONSE tab) > ["test_suite_reports","test_suite_db","mike","_users"] > > > > (3) I see no way to access the returned data in my program. It is not in the > DOM and there is no variable I can find that contains the response data. > Now if I change the ajax dataType request to just json > dataType: 'jsonp', to dataType: 'json', > then: > (1) the success handler fires > (2) BUT NO is data returned > (3) and I get this in response headers > HTTP/1.1 200 OK Server: CouchDB/1.0.2 (Erlang OTP/R14B) > Date: Sun, 30 Jan 2011 22:55:05 GMT > Content-Type: application/json > Content-Length: 55 > Cache-Control: must-revalidate > I think jsonP is required because this seems to be a cross-domain request. > But either I am missing something or perhaps CouchDB is not setup to handle > the callback processing required by jsonp requests. (see: > http://remysharp.com/2007/10/08/what-is-jsonp/) > Any help, advice, beer appreciated.... > > Also, I can not find any examples or documentation for: > jquery.couch.js (the jQ plugin) > and > couch.js (that ships with the couchDB installation). > Pointers to docs/examples much appreciated. > > Mike Behar > > > > > > > > > > > > > > > >
