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
精彩评论