vendredi 28 mars 2014

INVALID_STATE_ERR: DOM Exception 11 in AJAX


Vote count:

0




I was tried to link my application and Facebook. I'm using PhoneGap 2.9, and the problem was occured when I requested AJAX to Facebook. As you can see this : "application/x-www-form-urlencode", this need for sending an image. This is code :



var request = new XMLHttpRequest();
request.open(type, url, true);

if(data) {
request.setRequestHeader("Content-type","application/x-www-form-urlencoded");
request.setRequestHeader("Content-length", data.length);
request.setRequestHeader("Connection", "close");
request.send(data);
}

request.onreadystatechange = function() {
if (request.readyState == 4) {
if (request.status == 200 || request.status === 0) {
var data = request.responseText;

if(data) {
callback(data);
}
else {
callback(false);
}
}
else {
callback(false);
}
}
};

request.send();


These are What Am tried : 1. request.open(type, url, true); -> request.open(type, url, false);\ 2. changing "application/x-www-form-urlencoded" 3. check image url 4. open XmlHttpRequest before setting headers


I'm put it to my phone(using Android), always says "INVALID_STATE_ERR: DOM Exception 11". Is there a something wrong in my code? Basically, those codes not from me, those are part of PhoneGap plugin from github(phonegap.facebook.inappbrowser). Functions are not working so I open the source and tracking problem but nothing better.


I need help, because in my country, there is no one I can ask or get advice.



asked 40 secs ago






Aucun commentaire:

Enregistrer un commentaire