更新时间:2023-02-05 20:09:28
作为@JamWaffles答案的补充:
As an addition to @JamWaffles answer:
您可以仅使用return;
退出该函数,而不用调用request.abort();
.否则,您将对相同的数据发出两个AJAX请求=服务器不必要的负载.然后,您应该在成功和错误回调中使用request = null;
重置请求对象.
You may just exit the function with return;
instead of calling request.abort();
. Otherwise you will make two AJAX requests for the same data = unnecessary load for your server. You should then, however, reset the request object with request = null;
in the success and error callback.
PS.会将其作为评论发布,但我不能.
PS. Would post this as a comment, but I can't.