开发者

how to connect couchdb database using javascript

I am new to couchDB and Javascript. I need a simple java script code for connecting CouchDB database and reading a document and display开发者_Go百科ing the content in the browser window.

Please anyone help me.

Thanks, Nandha.


Using jQuery, you can display your document in <div id="target"></div> like this:

$('#target').load('/database/document-id');

To actually receive the document as a JavaScript object and manipulate it:

$.get('/database/document-id',{},function(doc) {
  // Do something with 'doc' here: 
  alert(doc._id);
},'json');


Don't forget to check out the Javascript examples here: https://github.com/apache/couchdb/tree/master/share/server

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜