From 262acc6f1e0f71a3a8b786e3c421b2e645799ea0 Mon Sep 17 00:00:00 2001 From: Erik Lax Date: Thu, 23 Mar 2017 14:33:25 +0100 Subject: Ajax: add an ontimeout handler to all requests Fixes gh-3586 Close gh-3590 --- src/ajax/xhr.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') 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 -- cgit v1.2.3