var xhr = newXMLHttpRequest (); xhr.onreadystatechange = function () { if (this.readyState == 4) { clearTimeout(timeout); // do something with response data } } var timeout = setTimeout( function () { xhr.abort(); // call error callback }, 60*1000/* timeout after a minute */ ); xhr.open('GET', url, true); xhr.send();