diff options
author | Erik Lax <erik@datahack.se> | 2017-03-23 14:33:25 +0100 |
---|---|---|
committer | Timmy Willison <4timmywil@gmail.com> | 2017-07-24 11:44:09 -0400 |
commit | 262acc6f1e0f71a3a8b786e3c421b2e645799ea0 (patch) | |
tree | d6b57361c556b2a13e73454b746733ae2795ece4 /src | |
parent | d65bdd5fc8edf390211ed2223a03c6a00a41c649 (diff) | |
download | jquery-262acc6f1e0f71a3a8b786e3c421b2e645799ea0.tar.gz jquery-262acc6f1e0f71a3a8b786e3c421b2e645799ea0.zip |
Ajax: add an ontimeout handler to all requests
Fixes gh-3586
Close gh-3590
Diffstat (limited to 'src')
-rw-r--r-- | src/ajax/xhr.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ajax/xhr.js b/src/ajax/xhr.js index 33dafb01d..4a31171ac 100644 --- a/src/ajax/xhr.js +++ b/src/ajax/xhr.js @@ -75,7 +75,8 @@ jQuery.ajaxTransport( function( options ) { return function() { if ( callback ) { callback = errorCallback = xhr.onload = - xhr.onerror = xhr.onabort = xhr.onreadystatechange = null; + xhr.onerror = xhr.onabort = xhr.ontimeout = + xhr.onreadystatechange = null; if ( type === "abort" ) { xhr.abort(); @@ -115,7 +116,7 @@ jQuery.ajaxTransport( function( options ) { // Listen to events xhr.onload = callback(); - errorCallback = xhr.onerror = callback( "error" ); + errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); // Support: IE 9 only // Use onreadystatechange to replace onabort |