From user-return-9071-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Tue Mar 02 15:49:25 2010 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 60223 invoked from network); 2 Mar 2010 15:49:25 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 2 Mar 2010 15:49:25 -0000 Received: (qmail 96880 invoked by uid 500); 2 Mar 2010 15:49:19 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 96679 invoked by uid 500); 2 Mar 2010 15:49:19 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 96669 invoked by uid 99); 2 Mar 2010 15:49:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Mar 2010 15:49:19 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of paul.joseph.davis@gmail.com designates 74.125.83.52 as permitted sender) Received: from [74.125.83.52] (HELO mail-gw0-f52.google.com) (74.125.83.52) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Mar 2010 15:49:10 +0000 Received: by gwb1 with SMTP id 1so170177gwb.11 for ; Tue, 02 Mar 2010 07:48:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=rXec3mxtmgSnoKigNdfnP73f6+SSz2BMlo1NabyIvmo=; b=BqkM3B/4eUiEGt1A+9jVxiQZ2soB6zS4A7t1Y7haZbXSY9YDjyaTWwenKf6gQI2bkM ApoiECGHAPXeLmtl6CLlgCXY+fxmATuulZXPZw8OYDAcvPBGM/dLS3WJ5heljOCJor9X HcakBQoyqjr6fDvERVIq32Jvvghqt4C1/GWUc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=hY1LhHRy39gRBGbNVqR1Fm9Z35fSHgHFgrGUkEicYIxO+4UtpVtzg78wZXElG+i9rI ZAMh3eJ0ru76+LfX9cHlNiVjSMKg4eLjdb+B5qBonLwNmwfmKihPmfQtNULBJLkTGX6u VSsVdAfS7GHQk/NPn5KHE/IWgiZ8kRDHcBLaQ= MIME-Version: 1.0 Received: by 10.101.179.34 with SMTP id g34mr53462anp.85.1267544924507; Tue, 02 Mar 2010 07:48:44 -0800 (PST) In-Reply-To: References: <20100302124537.GA6988@uk.tiscali.com> From: Paul Davis Date: Tue, 2 Mar 2010 10:48:24 -0500 Message-ID: Subject: Re: couchdb views POST keys To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable There's also a jquery.couch.js that comes with Futon that you could use. HTH, Paul Davis On Tue, Mar 2, 2010 at 9:38 AM, km wrote: > Hi all, > > this is what i needed! > thanks for the clarification - =A0it works :-) > > Krishna > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > On Tue, Mar 2, 2010 at 9:45 PM, Brian Candler 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 do= c >> ids. >> > >> > so I =A0have these doc ids >> > ##### javascript ########## >> > doc_ids =3D ['45631c12752bfdd3ee5c6934d633863a', >> > >> "aefe0494ba7563d09f1412e8bfb279f4","f82085c42ccd962a257ab31003c481e9",..= .] >> > doc_ids =3D 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=3DXXXX, = 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): >> >> =A0doc_ids =3D ['45631c12752bfdd3ee5c6934d633863a', ...]; >> =A0$.post('/mydb/_design_query/_view/getbyid, JSON.stringify({keys:docid= s}); >> >> Assuming $ is jQuery, see also >> >> http://api.jquery.com/jQuery.post/ >> http://api.jquery.com/jQuery.ajax/ >> >> HTH, >> >> Brian. >> >