cancel or abort ajax call in ie 6,7,8

2019-08-02 13:29发布

问题:

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

回答1:

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 Aborting a jQuery getJSON XMLHttpRequest )