[这是对先前答案的修改,此问题有待我解决后仍未解决]
当用户通过刷新,单击链接或更改浏览器中的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});


