I'm new to CouchDB, so please bear with me.
I have an instance of CouchDB running on a VM. I can access it just fine through the browser via futon or directly at:
http://192.168.62.128:5984/articles/hot_dog
Calling that URL in a browser returns the proper JSON. But, when I try to call that exact same URL via ajax, I get nothing:
var ajaxUrl = 'http://192.168.62.128:5984/articles/hot_dog';
$.getJSON(ajaxUrl, null, function(data) { alert(data); });
Looking at the response header with Firebug shows me that the HTTP response was 200
and the content-length
is the right size. Even the Etag
matches with what is in CouchDB. But the response itself is empty!
The URL is absolutely right; I've triple checked, and copy/pasted it directly (and besides it wouldn't give a 200 response if it weren't). I'm using jQuery 1.4.2, and CouchDB 0.8
What's going on?
Try appending callback=?
to the url like this. This will trigger jQuery to issue a jsonp request.
var ajaxUrl = 'http://192.168.62.128:5984/articles/hot_dog?callback=?';
If this doesn't fix it additionally you should append a sample output of the json this url gives in the browser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With