Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function loadHTML(node, url, timeout) {
if (timeout == undefined)
timeout = 10000;
var req = new XMLHttpRequest();
var timer = setTimeout(function() {
try {
req.abort();
} catch(e) {}
navigator.notification.loadingStop();
}, );
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status < 300) {
clearTimeout(timer);
var html = req.responseText;
html.replace(/.*<body>/, '');
html.replace(/<\/body>.*/, '');
node.innerHTML = html;
}
navigator.notification.loadingStop();
delete req;
delete node;
}
};
req.open('GET', url, true);
req.send();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.