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<[email protected] 
(mailto:[email protected])>  wrote:
The calls are all async. Add success callbacks like jQuery examples.
On Sep 15, 2012 5:27 PM, "john.tiger"<[email protected] 
(mailto:[email protected])>  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))





Reply via email to