I put this in my JavaScript, and introduced a 500 error in my $.ajax, but this routine never got called:
$('#msg').ajaxError(function(myEvent, jqXHR, ajaxSettings, thrownError) {
$(this).html(thrownError).addClass('alert alert-error');
});
If I add a .fail, then the .fail get’s called, but the ajaxError is never being invoked.
ajaxError() besides others are Global events and you will use these events whenever you have standard way of handling ALL ajax requests on you site ,instead of per ajax request. E.g showing some progress bar on success/failure ..
Jquery ajax global events
In above case , make sure your script fails to check the ajaxError e.g by requesting a invalid url etc .. Or Server responding invalid data