incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mike <withforesi...@gmail.com>
Subject AJAX POST from Local client to couchone.com -- gives 405 Method not allowed
Date Tue, 01 Feb 2011 18:35:34 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message