views:

114

answers:

1

how can i cancel a simple js ajax call while its being performed?

+1  A: 

normally with ajax.abort(); but on IE it wont really quit requesting:

Calling abort resets the object; the onreadystatechange event handler is removed, and readyState is changed to 0 (uninitialized).

the quote is from the Microsoft javascript docu. From this I guess it highly depends on the browser implementation what exactly is going on. most browser will probably try to finish gracefully - thus the connections might still be up for some time until finally closed - but thats just a guess.

(see also http://stackoverflow.com/questions/1287971/aborting-a-jquery-getjson-xmlhttprequest )

Niko