You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by "john.tiger" <jo...@gmail.com> on 2012/09/15 23:27:04 UTC

need help with jquery.couch

using couch 1.2 (debian unstable) in a simple html 5 page
I pulled jquery.couch.js from github  - is this right version to use ?  
trying to follow various references resulted in no data being shown.  
chrome js console not showing errors

working:
var test = $.couch.db("mydb");
alert("test"+ JSON.stringify(test));
=> alert shows name of database

not working:
var db = "mydb";
var test = $.couch.db(db);
alert("test"+ JSON.stringify(test));

not working:
var test = $.couch.allDocs();
alert("test"+ JSON.stringify(test));
(also did not work for allDbs, info, )

not working:
$db = $.couch.db("mydb");
var test = $db.allDocs();
alert("test"+ JSON.stringify(test));

not working:
$.couch.urlPrefix = "http://127.0.0.1:5984";
var test = $.couch.allDbs();
alert("test"+ JSON.stringify(test))



Re: need help with jquery.couch

Posted by "john.tiger" <jo...@gmail.com>.
On 09/16/2012 11:27 AM, Simon Metson wrote:
> Hi John,
> Are requests reaching Couch (e.g. do they get logged)? What happens if you just do raw jQuery ajax calls to Couch URLs?

nothing unusual in the logs - GET s are showing as return 200 -

another example of what is not working :

$("button#login_submit").on('click', function(event) {
         $.couch.db("sample").info({
           success: function(data){
             alert("info");  //also tried as alert(JSON.stringify(data));
           }
         });

});
=> screen flashes then returns to the html file (no alert box)

curl -X GET http://127.0.0.1:5984/sample/_all_docs => returns all the docs



> Cheers
> Simon
>
>
> On Saturday, 15 September 2012 at 23:23, john.tiger wrote:
>
>> On 09/15/2012 03:56 PM, Ryan Ramage wrote:
>>> John, just guessing but are you trying to access your couchdb from a
>>> local html file? ie openingfile://somepath/index.html  and trying to
>>> access couchdb? If so, you cant do that because of cross domain
>>> requests. You would want to move to a couchapp type tool if you want
>>> to do simple html pages, access couchdb.
>>>
>> what I mean by simple html app was that it was not a couchapp
>>
>> actually using nginx set up with a local fake domain on each development
>> machine - so I do not think that is a problem
>>
>> had originally tried with a success call which was not called (but with
>> that info, will experiment more in that direction.
>>> If you want to see the jquery.couch.js api, look here:
>>> http://daleharvey.github.com/jquery.couch.js-docs/symbols/%24.couch.db.html
>>>
>>> Also, there are a million ways to do this, but I would humbly
>>> recommendhttps://github.com/garden20/baseline-garden-app  . It is
>>> pretty easy to get going with. Ping me, or join #kanso if you need
>>> help.
>>>
>>> Other options include putting a proxy in-front of your couchdb that
>>> will allow you to access it cross domain.
>>>
>>> Ryan
>>>
>>> On Sat, Sep 15, 2012 at 3:43 PM, Zera Holladay<zeraholladay@gmail.com (mailto:zeraholladay@gmail.com)>  wrote:
>>>> The calls are all async. Add success callbacks like jQuery examples.
>>>> On Sep 15, 2012 5:27 PM, "john.tiger"<john.tigernassau@gmail.com (mailto:john.tigernassau@gmail.com)>  wrote:
>>>>
>>>>> using couch 1.2 (debian unstable) in a simple html 5 page
>>>>> I pulled jquery.couch.js from github - is this right version to use ?
>>>>> trying to follow various references resulted in no data being shown.
>>>>> chrome js console not showing errors
>>>>>
>>>>> working:
>>>>> var test = $.couch.db("mydb");
>>>>> alert("test"+ JSON.stringify(test));
>>>>> =>  alert shows name of database
>>>>>
>>>>> not working:
>>>>> var db = "mydb";
>>>>> var test = $.couch.db(db);
>>>>> alert("test"+ JSON.stringify(test));
>>>>>
>>>>> not working:
>>>>> var test = $.couch.allDocs();
>>>>> alert("test"+ JSON.stringify(test));
>>>>> (also did not work for allDbs, info, )
>>>>>
>>>>> not working:
>>>>> $db = $.couch.db("mydb");
>>>>> var test = $db.allDocs();
>>>>> alert("test"+ JSON.stringify(test));
>>>>>
>>>>> not working:
>>>>> $.couch.urlPrefix ="http://127.0.0.1:5984";
>>>>> var test = $.couch.allDbs();
>>>>> alert("test"+ JSON.stringify(test))
>>>>>
>>
>



Re: need help with jquery.couch

Posted by Simon Metson <si...@cloudant.com>.
Hi John, 
Are requests reaching Couch (e.g. do they get logged)? What happens if you just do raw jQuery ajax calls to Couch URLs?
Cheers
Simon


On Saturday, 15 September 2012 at 23:23, john.tiger wrote:

> 
> 
> On 09/15/2012 03:56 PM, Ryan Ramage wrote:
> > John, just guessing but are you trying to access your couchdb from a
> > local html file? ie opening file://somepath/index.html and trying to
> > access couchdb? If so, you cant do that because of cross domain
> > requests. You would want to move to a couchapp type tool if you want
> > to do simple html pages, access couchdb.
> > 
> 
> 
> what I mean by simple html app was that it was not a couchapp
> 
> actually using nginx set up with a local fake domain on each development 
> machine - so I do not think that is a problem
> 
> had originally tried with a success call which was not called (but with 
> that info, will experiment more in that direction.
> > 
> > If you want to see the jquery.couch.js api, look here:
> > http://daleharvey.github.com/jquery.couch.js-docs/symbols/%24.couch.db.html
> > 
> > Also, there are a million ways to do this, but I would humbly
> > recommend https://github.com/garden20/baseline-garden-app . It is
> > pretty easy to get going with. Ping me, or join #kanso if you need
> > help.
> > 
> > Other options include putting a proxy in-front of your couchdb that
> > will allow you to access it cross domain.
> > 
> > Ryan
> > 
> > On Sat, Sep 15, 2012 at 3:43 PM, Zera Holladay<zeraholladay@gmail.com (mailto:zeraholladay@gmail.com)> wrote:
> > > The calls are all async. Add success callbacks like jQuery examples.
> > > On Sep 15, 2012 5:27 PM, "john.tiger"<john.tigernassau@gmail.com (mailto:john.tigernassau@gmail.com)> wrote:
> > > 
> > > > using couch 1.2 (debian unstable) in a simple html 5 page
> > > > I pulled jquery.couch.js from github - is this right version to use ?
> > > > trying to follow various references resulted in no data being shown.
> > > > chrome js console not showing errors
> > > > 
> > > > working:
> > > > var test = $.couch.db("mydb");
> > > > alert("test"+ JSON.stringify(test));
> > > > => alert shows name of database
> > > > 
> > > > not working:
> > > > var db = "mydb";
> > > > var test = $.couch.db(db);
> > > > alert("test"+ JSON.stringify(test));
> > > > 
> > > > not working:
> > > > var test = $.couch.allDocs();
> > > > alert("test"+ JSON.stringify(test));
> > > > (also did not work for allDbs, info, )
> > > > 
> > > > not working:
> > > > $db = $.couch.db("mydb");
> > > > var test = $db.allDocs();
> > > > alert("test"+ JSON.stringify(test));
> > > > 
> > > > not working:
> > > > $.couch.urlPrefix = "http://127.0.0.1:5984";
> > > > var test = $.couch.allDbs();
> > > > alert("test"+ JSON.stringify(test))
> > > > 
> > > 
> > > 
> > 
> > 
> 
> 
> 



Re: need help with jquery.couch

Posted by "john.tiger" <jo...@gmail.com>.

On 09/15/2012 03:56 PM, Ryan Ramage wrote:
> John, just guessing but are you trying to access your couchdb from a
> local html file? ie opening file://somepath/index.html and trying to
> access couchdb? If so, you cant do that because of cross domain
> requests. You would want to move to a couchapp type tool if you want
> to do simple html pages, access couchdb.

what I mean by simple html app was that it was not a couchapp

actually using nginx set up with a local fake domain on each development 
machine - so I do not think that is a problem

had originally tried with a success call which was not called (but with 
that info, will experiment more in that direction.
>
> If you want to see the jquery.couch.js api, look here:
> http://daleharvey.github.com/jquery.couch.js-docs/symbols/%24.couch.db.html
>
> Also, there are a million ways to do this, but I would humbly
> recommend https://github.com/garden20/baseline-garden-app . It is
> pretty easy to get going with. Ping  me, or join #kanso if you need
> help.
>
> Other options include putting a proxy in-front of your couchdb that
> will allow you to access it cross domain.
>
> Ryan
>
> On Sat, Sep 15, 2012 at 3:43 PM, Zera Holladay<ze...@gmail.com>  wrote:
>> The calls are all async.  Add success callbacks like jQuery examples.
>> On Sep 15, 2012 5:27 PM, "john.tiger"<jo...@gmail.com>  wrote:
>>
>>> using couch 1.2 (debian unstable) in a simple html 5 page
>>> I pulled jquery.couch.js from github  - is this right version to use ?
>>>   trying to follow various references resulted in no data being shown.
>>>   chrome js console not showing errors
>>>
>>> working:
>>> var test = $.couch.db("mydb");
>>> alert("test"+ JSON.stringify(test));
>>> =>  alert shows name of database
>>>
>>> not working:
>>> var db = "mydb";
>>> var test = $.couch.db(db);
>>> alert("test"+ JSON.stringify(test));
>>>
>>> not working:
>>> var test = $.couch.allDocs();
>>> alert("test"+ JSON.stringify(test));
>>> (also did not work for allDbs, info, )
>>>
>>> not working:
>>> $db = $.couch.db("mydb");
>>> var test = $db.allDocs();
>>> alert("test"+ JSON.stringify(test));
>>>
>>> not working:
>>> $.couch.urlPrefix = "http://127.0.0.1:5984";
>>> var test = $.couch.allDbs();
>>> alert("test"+ JSON.stringify(test))
>>>
>>>
>>>


Re: need help with jquery.couch

Posted by Ryan Ramage <ry...@gmail.com>.
John, just guessing but are you trying to access your couchdb from a
local html file? ie opening file://somepath/index.html and trying to
access couchdb? If so, you cant do that because of cross domain
requests. You would want to move to a couchapp type tool if you want
to do simple html pages, access couchdb.

If you want to see the jquery.couch.js api, look here:
http://daleharvey.github.com/jquery.couch.js-docs/symbols/%24.couch.db.html

Also, there are a million ways to do this, but I would humbly
recommend https://github.com/garden20/baseline-garden-app . It is
pretty easy to get going with. Ping  me, or join #kanso if you need
help.

Other options include putting a proxy in-front of your couchdb that
will allow you to access it cross domain.

Ryan

On Sat, Sep 15, 2012 at 3:43 PM, Zera Holladay <ze...@gmail.com> wrote:
> The calls are all async.  Add success callbacks like jQuery examples.
> On Sep 15, 2012 5:27 PM, "john.tiger" <jo...@gmail.com> wrote:
>
>> using couch 1.2 (debian unstable) in a simple html 5 page
>> I pulled jquery.couch.js from github  - is this right version to use ?
>>  trying to follow various references resulted in no data being shown.
>>  chrome js console not showing errors
>>
>> working:
>> var test = $.couch.db("mydb");
>> alert("test"+ JSON.stringify(test));
>> => alert shows name of database
>>
>> not working:
>> var db = "mydb";
>> var test = $.couch.db(db);
>> alert("test"+ JSON.stringify(test));
>>
>> not working:
>> var test = $.couch.allDocs();
>> alert("test"+ JSON.stringify(test));
>> (also did not work for allDbs, info, )
>>
>> not working:
>> $db = $.couch.db("mydb");
>> var test = $db.allDocs();
>> alert("test"+ JSON.stringify(test));
>>
>> not working:
>> $.couch.urlPrefix = "http://127.0.0.1:5984";
>> var test = $.couch.allDbs();
>> alert("test"+ JSON.stringify(test))
>>
>>
>>

Re: need help with jquery.couch

Posted by Zera Holladay <ze...@gmail.com>.
The calls are all async.  Add success callbacks like jQuery examples.
On Sep 15, 2012 5:27 PM, "john.tiger" <jo...@gmail.com> wrote:

> using couch 1.2 (debian unstable) in a simple html 5 page
> I pulled jquery.couch.js from github  - is this right version to use ?
>  trying to follow various references resulted in no data being shown.
>  chrome js console not showing errors
>
> working:
> var test = $.couch.db("mydb");
> alert("test"+ JSON.stringify(test));
> => alert shows name of database
>
> not working:
> var db = "mydb";
> var test = $.couch.db(db);
> alert("test"+ JSON.stringify(test));
>
> not working:
> var test = $.couch.allDocs();
> alert("test"+ JSON.stringify(test));
> (also did not work for allDbs, info, )
>
> not working:
> $db = $.couch.db("mydb");
> var test = $db.allDocs();
> alert("test"+ JSON.stringify(test));
>
> not working:
> $.couch.urlPrefix = "http://127.0.0.1:5984";
> var test = $.couch.allDbs();
> alert("test"+ JSON.stringify(test))
>
>
>