javascript - DOM Exception 19 for PUT request -


i'm making put request upload object s3 bucket using xmlhttprequest in javascript. cors set properly. code i'm trying with.

        var bucketpath = 'http://<bucket-name>.s3.amazon.com/'         var filename = <name> + ".json";         var uploadpath = bucketpath + filename.replace(/\s/g,"+");         var xmlhttp;         if (window.xmlhttprequest)           {// code ie7+, firefox, chrome, opera, safari           xmlhttp=new xmlhttprequest();           }         else           {// code ie6, ie5           xmlhttp=new activexobject("microsoft.xmlhttp");           }           xmlhttp.onreadystatechange=function()           {           if (xmlhttp.readystate==4 && xmlhttp.status==200)             {                 showdata();             }             else{                 showerror();             }           };         xmlhttp.open("put",uploadpath,false);         xmlhttp.send(json.stringify(jsonobject), replacer); 

i dom exception 19 @ last line of code. not sure wrong. tried doing same sample test script , works. when try use application altogether, throwing exception.

in network tab under chrome debugger, can see http request method options , type pending.

i couldn't see actual put request being sent. can tell me problem , exception meant?

update: after looking requests being sent jsfiddle , application. see 2 requests being sent js fiddle preflight http options request , after actual put request.

while works great on js fiddle, on otherhand same code applications sends preflight http options request doesn't 200 status pending. reason why failing.

any ideas why i'm not getting success http options request.

ok got bug. nothing cors. url i'm trying put request should http://bucket-name.s3.amazonaws.com/


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -