Hi all, this is what i needed! thanks for the clarification - it works :-)
Krishna ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ On Tue, Mar 2, 2010 at 9:45 PM, Brian Candler <[email protected]> wrote: > On Tue, Mar 02, 2010 at 08:26:17PM +0900, km wrote: > > I would like to fetch documents from a view by posting it a list of doc > ids. > > > > so I have these doc ids > > ##### javascript ########## > > doc_ids = ['45631c12752bfdd3ee5c6934d633863a', > > > "aefe0494ba7563d09f1412e8bfb279f4","f82085c42ccd962a257ab31003c481e9",...] > > doc_ids = JSON.stringify(doc_ids); > > > > //using jquery to post the key list to the url > > $.post('/mydb/_design/query/_view/getbyid', > {keys:doc_ids},function(data){ > > > > alert(data) > > > > } > > ); > > I think what you're trying to do is post a FORM with field keys=XXXX, and > that's wrong. > > You need to post a single JSON object like this: {keys:["key1","key2"]} > > So: don't stringify doc_ids. Build a json object of {keys:doc_ids}, > stringify that, and send it as the entire request body. > > Try this (untested): > > doc_ids = ['45631c12752bfdd3ee5c6934d633863a', ...]; > $.post('/mydb/_design_query/_view/getbyid, JSON.stringify({keys:docids}); > > Assuming $ is jQuery, see also > > http://api.jquery.com/jQuery.post/ > http://api.jquery.com/jQuery.ajax/ > > HTH, > > Brian. >
