$.ajax({
type: "POST",
url: "/php/auth/login.php",
data: $("#login-form").serialize(),
success: function(msg) {
//stuffs
},
complete: function() {
$(this).data('requestRunning', false);
}
});
答案 0 :(得分:0)
使用一个标志,进行检查并将其设置为false
let shouldAjax = true;
// later
if (shouldAjax) {
$.ajax({
type: "POST",
url: "/php/auth/login.php",
data: $("#login-form").serialize(),
success: function(msg) { //stuffs
},
complete: function() {
$(this).data('requestRunning', false);
shouldAjax = false;
}
});
}