Basically my error callback on the ajax request is still being
executed after I have called the abort() method on the Xhr.

I am creating a live search function.
On our development server, we don't have access to the live server, to
retrieve the ajax response.
So the error callback is executed after 45 seconds (our timeout
length).
Even after the Xhr is aborted, the error callback is still executed.
Everything works properly on the Live server, because the Ajax is
getting a response before timing out.

This is basically how the code is set up: ( Lots removed for brevity )

// Textbox has a timeout, and the search function is called after 850
milliseconds of not typing
concertFinder.timeout = setTimeout( 'concertFinder.resortGenres()',
850 );

// I then check if an Xhr is already executing, and abort it if it is
if( this.xhr ){
        this.xhr.abort();
}

// I then execute the ajax request
this.xhr = $.ajax({
url: theUrl,
type: 'GET',
dataType: 'json',
timeout: 45000,
error: function( XMLHttpRequest, textStatus, errorThrown ){ },
success: function(json){}
});


An example:

Say I am typing in the search field and pause for 850 ms.
An Ajax request will start.
I then start typing again and pause.
Another Ajax request will start up.
Now I would assume that the first request would stop all its execution
(Firebug stops twirling for that request)
But after the 45 second timeout, the first Ajax request's error
callback is executed.

Then again the second error callback is executed, because the time
between the request initialisations is only about a second.

Does anyone have any ideas?
Oh I should mention that I tried the Ajax Manager plugin--with
AbortOld--and the same problem occurred.

Reply via email to