我使用以下代码在竞争条件下限制获取请求:
if (currentAjaxRequest !== null) {
currentAjaxRequest.abort();
}
var query_string = getQuery();
currentAjaxRequest = $.get(query_string, function(data, textStatus, xhr) {
if (xhr.status) {
currentAjaxRequest = null;
// do stuff
}
});
我注意到在 Chrome 中,当调用 abort 时,javascript 控制台中会弹出一个错误:
获取未定义(未定义)
这似乎根本不会影响脚本 - 一切都继续运行良好。我应该做些什么来纠正这个问题?或者这只是 chrome 报告中止的 ajax 请求的方式?
谢谢你的帮助