- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
CouchJs : the JavaScript interpreter for CouchDB
CouchDB : a NonSQL db where you execute most things in user-space with things such as JS because things tend to be expensive to execute on the database-level
Integrity : In information security, integrity means that data cannot be modified undetectably. More here.
CouchJS website没有内部搜索,在谷歌搜索或多或少令人困惑的博客文章后,我迷失了方向。我在哪里可以找到一些简单的例子(不仅仅是 curl /远程登录),如下所示?
<script type="text/javascript" src="lib/jquery-1.7.2.js"></script>
<script type="text/javascript" src="lib/jquery-ui-1.8.21.custom.min.js"></script>
<script src="http://127.0.0.1:5984/_utils/script/jquery.couch.js"></script>
//# 1. initilalize the db -object
//# 2. save something to the db with the object
<script> db.test.save('hello world') </script>也许对其他新手有用
最佳答案
建立在弗洛里安答案之上——因为当我指出一些错误时他删除了他的答案here请浏览一下他在历史上的回答。他推荐了有关文档更新处理程序的文章 here和示例 here 。至少有两个问题,XMLHttpRequest here需要一个字符串,而不是对象——我编辑了他的答案以添加 XMLHttpRequest -手册以进行进一步调查,但由于某种原因有人取消了编辑。因此,我正在制作自己的答案,其中包含最多的修复,但仍然令人恼火的 DOM 11,我仍在尝试解决。
// By this function we solve the problem with Object,
// changing JSON -object to string. The source is:
// https://stackoverflow.com/questions/111529/create-query-parameters-in-javascript
function EncodeQueryData(data)
{
var ret = [];
for (var d in data)
ret.push(encodeURIComponent(d) + "=" + encodeURIComponent(data[d]));
return ret.join("&");
}
// We use ready CouchDB -example, source:
// http://wiki.apache.org/couchdb/HTTP_Document_API#PUT
var datas = {
"Subject":"I like Plankton",
"Author":"Rusty",
"PostedDate":"2006-08-15T17:30:12-04:00",
"Tags":["plankton", "baseball", "decisions"],
"Body":"I decided today that I don't like baseball. I like plankton."
};
// We use the default -function, please, see the O'Reilly.
// https://developer.mozilla.org/En/XMLHttpRequest/Using_XMLHttpRequest
var xhr = new XMLHttpRequest();
// This may be wrong
xhr.open( 'POST', 'test.js', true );
xhr.setRequestHeader( 'Content-Type', 'application/json' );
xhr.open( 'POST', '127.0.0.1:5984/test/559c327683fe0acb96aff72bd174c258', true);
var msg = EncodeQueryData(datas);
xhr.send(msg);
待办事项
- Now there is one error XMLHttpRequest "does not handle nested objects" but string so we need either more complex command or arrayswith XMLHttpRequest. I thank C.*rk for helping me with this.
- Probably RELATING TO test.js, under investigation the err:
"XMLHttpRequest cannot load %3127.0.0.1:5984/test/559c327683fe0acb96aff72bd174c258. Cross origin requests are only supported for HTTP. Error: NETWORK_ERR: XMLHttpRequest Exception 101"
相关谜题
关于jquery - 关于用户空间中的 CouchJS 的简单示例,例如使用浏览器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11076076/
我运行此代码 here --> $.couch.activeTasks({ success: function (data) { console.log(data
定义 CouchJs : the JavaScript interpreter for CouchDB CouchDB : a NonSQL db where you execute most thi
我是一名优秀的程序员,十分优秀!