123
rated 0 times
[
127]
[
4]
/ answers: 1 / hits: 16782
/ 13 Years ago, tue, october 11, 2011, 12:00:00
I am adapting the XMLHttpRequest
from this tutorial:
var request = new XMLHttpRequest();
request.open('GET', 'http://www.mozilla.org/', true);
request.onreadystatechange = function (aEvt) {
if (request.readyState == 4) {
if (request.status == 200)
console.log(request.responseText)
else
console.log('Error', request.statusText);
}
};
request.send(null);
My code is:
var xhr = new XMLHttpRequest();
xhr.open(POST, http://ting-1.appspot.com/submithandlertest, true);
xhr.onreadystatechange = function (aEvt) {
if (xhr.readyState == 4) {
if (xhr.status == 200)
console.log(request 200-OK);
chrome.browserAction.setBadgeText ( { text: done } );
else
console.log(connection error);
chrome.browserAction.setBadgeText ( { text: ERR } );
setTimeout(function () {
chrome.browserAction.setBadgeText( { text: } );
}, 2000);
}
}
xhr.send(formData);
But Chrome debugger gives a Uncaught SyntaxError: Unexpected identifier
error on the else
. What am I doing wrong? Thanks!
More From » google-chrome