尝试类似这样的方法,在该函数中,无论发生什么情况,一旦完成,您就可以对每个请求运行。这应该可以解决问题:
// Store a global var so we can all play nicely.// Make sure this gets reset to false right before your AJAX call,// or it will only work once!var weHaveSuccess = false;$.ajax({ type: "POST", url: someurl, contentType : "text/xml", data: somedata, username: user, password: pass, success: function(data,status,xhr){ alert("Hurrah!"); weHaveSuccess = true; }, error: function(xhr, status, error){ alert("Error!" + xhr.status); }, complete: function(){ if(!weHaveSuccess){ alert('Your username/password seems to be incorrect!'); } }, dataType: "xml"});
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)