如果您的ajax请求在完成之前被取消,则可能会发生这种情况。当用户通过刷新,单击链接或更改浏览器中的URL离开页面时,jQuery引发错误事件。通过为ajax调用实现错误处理程序并检查xmlHttpRequest对象,可以检测到这些类型的错误:
$.ajax({ error: function (xmlHttpRequest, textStatus, errorThrown) { if(xmlHttpRequest.readyState == 0 || xmlHttpRequest.status == 0) return; // it's not really an error else // Do normal error handling});


