Access CouchDB with XHR using Javascript
I've been looking into CouchDB recently and I'm currently having the problem that I don't know how I would access it using Javascript.
As far as I know at the moment my options are:
- XHR: Doesn't work. Same-Origin-Policy is in the way. I also don't seem to be able to make CouchDB send the additional
Access-Control-Allow-Origin
header. - JSONP: Limits the request to the
GET
method.
So how do I a开发者_JAVA百科ccess the database?
CouchDB does not support cross-origin queries at this time. (I have a patch submitted that I expect to be in the next release.)
The vast majority of CouchDB users are doing one of two things:
- Serving the web page directly from CouchDB (no cross-origin problems)
- Serving web page normally, and the server queries CouchDB, possibly proxying the XHR
精彩评论