简单的问题,但从 Mozilla JS 文档中看并不明显。任何人都知道答案吗?
最佳答案
这是标准实现。基于以下,唯一的方法是检查对象的 readyState,但这在所有浏览器中都不起作用。
Syntax
XMLHttpRequest.abort() Return Value
No return value.
Remarks
abort was introduced in Windows Internet Explorer 7.
The abort method interrupts an asynchronous operation in progress. (Pass true to the varAsync parameter of open to create an asynchronous request.)
Calling abort resets the object; the onreadystatechange event handler is removed, and readyState is changed to 0 (uninitialized).
关于javascript - 我如何判断 "abort()"是否已在 XMLHTTPRequest 上被调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1064196/