The jquery $.ajaxSetup() allows you to set default values for future Ajax requests. Here’s how to use this function to set a default generic error message
$.ajaxSetup({
  error: function(e, xhr, options, ex) {
    alert("A Generic AJAX error " + ex);
  }
});So now each time an error occurs during an ajax request and the error is not handled, this error message will be used automatically.
Note: jQuery uses $.ajaxerror to register a handler to be called when Ajax requests complete with an error
Tweet
No comments:
Post a Comment