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/11/09 20:07:45 UTC

problems with jquery.couch / REST calls

trying to test out new CORS branch but not getting anywhere - we have a 
small login form with the submit button called by a jquery click command 
(which works with alert test)

here's different stuff that I have tried inside the button click to no 
luck - also I don't even see anything in the js console (so assume no js 
errors) and don't see anything in logs in /usr/local/var/log/couchdb  - 
in the home folder of the code the error log only shows missing favicon 
- any suggestions how I should be getting better log data as to what's 
happening or not happening ?


alert("login");
=> shows alert => button click is working

var form = $(event.target).parents("form#login_form");
var doc = login_form_to_doc(null,form);
alert("form "+ JSON.stringify(doc));
=> shows content of login form => ok

var test = $.couch.db("testdb");
alert("db test " + JSON.stringify(test))
=> shows url of testdb => I think ok

$.couch.db("testdb").info({
   success: function(data){
     alert("info"+JSON.stringify(data));
   }
});
=> no alert, nothing in logs

$.get("http://127.0.0.1:5984/testdb",
   function(data){
     alert("Data Loaded: " + data);
   }
);
=> no alert, nothing in logs

$.ajax({
   url: "http://127.0.0.1:5984/testdb",
   data: data,
   success: function(data) {
     alert("Data Loaded: " + JSON.stringify(data));
   },
   dataType: json
});
=> no alert, nothing in logs

var db = "testdb";
$.couch.db(db).create();
var foo = new Object();
foo.name = "joe";
foo.password = "secret";
$.couch.db("tigertest").saveDoc(foo);
=> no alert, nothing in logs

$.couch.login({
   name:"jdoe",
   password:"tigernassau",
   success: function(data){
     alert("Welcome!");
     log.console(data);
     close_dialog();
   },
   error: function(status){
     alert("login failed");
     log.console(status);
     close_dialog();
   }
});
=> no alert, nothing in logs