I do lots of $.ajax calls, and I handle errors from them in a way that throws up a message. I find that if an ajax call is in progress while the page gets reloaded, e.g. click
Add an unload handler, which sets a flag to true. Then, inside the error
handler, you can check this flag, and do something appropriate.
Example:
var unloading = false;
$.ajax(...) ...
.error(function(jqXHR) {
if (unloading) return; // Ignore errors caused by navigating away
// Now, check for real errors ..
});
$(window).unload(function() {unloading = true;});