Besides passing a callback to the load() function as Ólafur Waage suggests, you can also register "global" error handlers (global as in global for all ajax calls on the page).
There are at least two ways to register global Ajax error handlers :
Register just the error handler with ajaxError()
:
$.ajaxError(function(event, request, settings) {
alert("Oops!!");
});
Or, use ajaxSetup()
to set up an error handler and other properties at the same time:
$.ajaxSetup({
timeout: 5000,
error: function(event, request, settings){
alert("Oops!");
}
});