You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by mike <wi...@gmail.com> on 2011/02/01 19:35:34 UTC

AJAX POST from Local client to couchone.com -- gives 405 Method not allowed

Using just my local browser (and a little jQuery -latest == 1.5)  I am
trying to add a field to an existing document stored on my
couchone.comaccount.   (In the configuration file I have set:
*allow_jsonp = true)*

This code runs in the Firebug console and creates this uri, which does not
seem to contain my name && password:

http://withforesight.couchone.com/mike/489118d421996869057c5cd9fd000bbb?%20-d%20{field2:%22myData%22,_rev:1-15f65339921e497348be384867bb940f}

The result of this request is a 405 message (method not allowed).

urlDB ="http://withforesight.couchone.com/mike/"; // the database name is *
mike*
doc = "489118d421996869057c5cd9fd000bbb";  // correct document id
rev = "1-15f65339921e497348be384867bb940f";
addField = '? -d {field2:"myData",_rev:'+rev+'}'; // hopefully the cmd
needed to add a new field to the doc


$.ajax({
  type:'PUT',  // POST also gives the 405 message.
  url: urlDB+doc+addField,  // seems correct
  dataType: 'json',
  data:{name:'myname', password:'mypassword'},
  success: function(Response){ console.log('success response is: \n',
Response) },
  error: function(XMLHttpRequest, textStatus,
errorThrown){console.log('errors here\n',textStatus, errorThrown); },
  complete: function(req) {console.log("\n completed \n", req);}
});

Changing the dataType to jasonp, results in success, but what is returned is
the unmodified original document.

Also, with jsonp,  params tab shows name and password are being passed like
so:
http://withforesight.couchone.com/mike/489118d421996869057c5cd9fd000bbb?%20-d%20{field2:%22myData%22,_rev:1-15f65339921e497348be384867bb940f}&callback=jQuery1505063046393427024_1296582698400&name=myname&password=mypasswordt&_=1296584144399


Am I missing something else here?  Is it possible to POST from a local
browser or is this some sort of cross-domain issue that needs more on the
server.

Advice, working examples, much appreciated.

Mike Behar