xhr.timeout = 4000; // Set timeout to 4 seconds (4000 milliseconds) xhr.ontimeout = function () { alert("Timed out!!!"); } It would be great if the above functionality is added to the library.