
Untitled
By: a guest on
Jun 9th, 2012 | syntax:
None | size: 0.52 KB | hits: 21 | expires: Never
debugging chrome extension
...
function init() {
getdata();
}
var txt;
function getdata() {
var xhr = new XMLHttpRequest();
xhr.open('GET',myurl, true);
xhr.setRequestHeader('Cache-Control', 'no-cache');
xhr.setRequestHeader('Pragma', 'no-cache');
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) if (xhr.responseText) {
txt = xhr.responseText;
}
}
xhr.send();
console.log(txt);
}
...
<body onload="init();">
...