Skip to content

Instantly share code, notes, and snippets.

@beatgammit
Created September 8, 2011 23:14
Show Gist options
  • Save beatgammit/1205053 to your computer and use it in GitHub Desktop.
Save beatgammit/1205053 to your computer and use it in GitHub Desktop.
Reqwest timeout bug
function bug() {
window.reqwest({
'url': 'http://thisdoesntexisthahahaha.com',
'timeout': 1000 * 5,
'type': 'html',
'success': function () {
alert('http://thisdoesntexisthahahaha.com exists??');
},
'error': function () {
console.error('Error, trying again');
setTimeout(bug, 1000 * 5);
}
});
}
var head= document.getElementsByTagName('head')[0];
var script= document.createElement('script');
script.type= 'text/javascript';
script.src= 'https://raw.github.com/ded/reqwest/master/reqwest.js';
head.appendChild(script);
// no IE support, hahahaha
script.onload = bug;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment