Problem with ajax timeouts and IE7
I'm using $.ajax and I'm having jQuery throw an error inside its code.
From 5229 of the uncompressed jQuery..
- try {
- var oldAbort = xhr.abort;
- xhr.abort = function() {
- if (xhr) {
- oldAbort.call(xhr);
- }
- onreadystatechange("abort");
- };
- } catch (e) {
Line # 6 above is what is throwing an error in IE's debugger.
Yes, its in a try/catch, but that isn't stopping IE from throwing an error and preventing my $.ajax error function from being called.
Edit: it appears that since its in a callback function the try/catch doesn't have an effect (apparently I'm still not awake this morning).
My code looks like..
- xhr = $.ajax({
- url: baseUrl + "/Gears/online",
- cache: false,
- dataType: 'text',
- timeout: 7000,
- error: function(xhr, errorDesc) {
- // Error
- location.href = baseUrl + "/Account/Logon";
- },
- success: function(data, status, xhr) {
- // Able to retrieve a request from the server
- //debugger;
- if (xhr.status == 403) {
- // not logged in, redirect to login page
- location.href = baseUrl + "/Account/Logon";
- return;
- }
- else if (data == "OK") {
- // System is online
- if (_backOnlineReAuth) {
- // changed user, reauth
- location.href = baseUrl + "/Account/LogOff";
- return;
- }
- // Good to go!
- if (_isOnline) return;
- // Status change: Offline -> Online
- _goOnline();
- console.notice("Back Online", "Connection restored");
- }
- },
- complete: function() {
- // Continue with the next item in the app start-up queue
- nextQueue();
- }
- });
- }