使用 Javascript 通过 XHR 访问 CouchDB
我最近一直在研究 CouchDB,目前遇到的问题是我不知道如何使用 Javascript 访问它。
据我所知,目前我的选择是:
- XHR:不起作用。同源策略是障碍。我似乎也无法让 CouchDB 发送额外的
Access-Control-Allow-Origin
标头。 - JSONP:将请求限制为
GET
方法。
那么如何访问数据库呢?
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 access the database?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
CouchDB 目前不支持跨域查询。 (我提交了一个补丁,预计会在下一个版本中出现。)
绝大多数 CouchDB 用户正在做以下两件事之一:
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: