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 )