Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 56992 invoked from network); 31 Jan 2011 01:54:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 31 Jan 2011 01:54:35 -0000 Received: (qmail 48621 invoked by uid 500); 31 Jan 2011 01:54:34 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 48592 invoked by uid 500); 31 Jan 2011 01:54:33 -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 48584 invoked by uid 99); 31 Jan 2011 01:54:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 31 Jan 2011 01:54:33 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of withforesight@gmail.com designates 209.85.215.52 as permitted sender) Received: from [209.85.215.52] (HELO mail-ew0-f52.google.com) (209.85.215.52) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 31 Jan 2011 01:54:28 +0000 Received: by ewy23 with SMTP id 23so2102138ewy.11 for ; Sun, 30 Jan 2011 17:54:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=7s/yF1iRZ8jsy+uZivKtwNoWGkRx4sRQxMwt47fX/Yg=; b=JVODQGo9qckblk444uKLAwkw+VsZwGdVhxljb/MXrvTMWKowpQIAKWjmmySKLPnrbs kgQIz66vcf9fztFbwQCbtO2IJQzM6A1OIAOPmpxoaeaHwc84LOuDr+UG0t2DZQDoMjRB I0L0Bsrt+uprwpA11p9KbWIq8bXxB8wpAuOLw= 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; b=W5r+o3/pXybStQ5XqDN/yoA0c3zFTdgbq7u7t0+qX7/TEjxfBna0gA9tzu3EVzCgFe BDZ/O6BwFWy1rgu837qUZT9KFTryf8ztKHohRZDOR/UFUuOECxEQIY0ykP8QVswLbL+f +cHc2EpdXX6ViHznpmtbS6gj1yLbpbnGX4K4E= Received: by 10.14.123.14 with SMTP id u14mr6289181eeh.39.1296438846418; Sun, 30 Jan 2011 17:54:06 -0800 (PST) MIME-Version: 1.0 Received: by 10.14.119.7 with HTTP; Sun, 30 Jan 2011 17:53:46 -0800 (PST) In-Reply-To: References: <7DE6CCB6-DD85-429B-8FCB-D08F9766F98D@apache.org> From: mike Date: Sun, 30 Jan 2011 20:53:46 -0500 Message-ID: Subject: Re: jquery ajax: json vs jsonp To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=e0cb4e6ff365e9f1da049b1ab058 --e0cb4e6ff365e9f1da049b1ab058 Content-Type: text/plain; charset=ISO-8859-1 Never-mind ... answering my own question -- just double click in the field to be changed... duh.. Mike On Sun, Jan 30, 2011 at 8:49 PM, mike wrote: > Hi Jan, > > Thanks. > > Is there a browser interface that will allow me to change config.html so I > can make *allow_jsonp TRUE* > > Best, > > Mike > > > > On Sun, Jan 30, 2011 at 7:07 PM, Jan Lehnardt wrote: > >> Hi Mike, >> >> you have to specifically enable JSONP. See the "Configuration" pane in >> Futon. >> >> There are minimal API docs for couch.js and jquery.couch.js here: >> >> http://www.couchone.com/page/library-couch-js >> http://www.couchone.com/page/library-jquery-couch-js >> >> Cheers >> Jan >> -- >> >> >> >> >> >> On 31 Jan 2011, at 00:41, mike wrote: >> >> > I just started exploring couchDB and ran into this problem. I am trying >> to access some stuff on my newly created couchone.com database. I just >> want to learn how to fetch the names of the databases I have created using >> an ajax call from a client browser running on a local pc. >> > >> > Using jQuery (in Firexox) in the firebug command window I run this: >> > >> > test = function(){ >> > url = "http://withforesight.couchone.com/_all_dbs"; >> > $.ajax({ >> > url: url, >> > dataType: 'jsonp', >> > success: ( function(Response){ console.log(26, 'response is: ', >> Response) } ), >> > error: function(XMLHttpRequest, textStatus, >> errorThrown){alert("Error"); } >> > }); >> > >> > }; >> > test() >> > >> > I receive the following reply from the server: >> > HTTP/1.1 200 OK >> > Server: CouchDB/1.0.2 (Erlang OTP/R14B) >> > Date: Sun, 30 Jan 2011 22:52:29 GMT >> > Content-Type: text/plain;charset=utf-8 >> > Content-Length: 55 >> > Cache-Control: must-revalidate >> > >> > In all cases I see a status code of 200OK. (note odd content type). >> > >> > However: >> > (1) the success handler DOES NOT trigger. Nothing appears in the >> console log. >> > (2) In the NET tab I see the data has been returned both in JSON format >> and as an array (under the RESPONSE tab) >> > ["test_suite_reports","test_suite_db","mike","_users"] >> > >> > >> > >> > (3) I see no way to access the returned data in my program. It is not >> in the DOM and there is no variable I can find that contains the response >> data. >> > Now if I change the ajax dataType request to just json >> > dataType: 'jsonp', to dataType: 'json', >> > then: >> > (1) the success handler fires >> > (2) BUT NO is data returned >> > (3) and I get this in response headers >> > HTTP/1.1 200 OK Server: CouchDB/1.0.2 (Erlang OTP/R14B) >> > Date: Sun, 30 Jan 2011 22:55:05 GMT >> > Content-Type: application/json >> > Content-Length: 55 >> > Cache-Control: must-revalidate >> > I think jsonP is required because this seems to be a cross-domain >> request. But either I am missing something or perhaps CouchDB is not setup >> to handle the callback processing required by jsonp requests. (see: >> http://remysharp.com/2007/10/08/what-is-jsonp/) >> > Any help, advice, beer appreciated.... >> > >> > Also, I can not find any examples or documentation for: >> > jquery.couch.js (the jQ plugin) >> > and >> > couch.js (that ships with the couchDB installation). >> > Pointers to docs/examples much appreciated. >> > >> > Mike Behar >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> >> > --e0cb4e6ff365e9f1da049b1ab058--