title: how to know there is error handler in jquery AjaxError?
body: <p>I want to add a global ajaxError handler for all ajax request, if user already declares error handler, this global ajaxError handler does nothing, if user doesnot declare an error handler, then pops up an alert window.
  here is my code:</p>
  
  <pre><code>$(document).ajaxError(function(event, xhr, settings, thrown){
      if(settings.fail || settings.error || settings.complete){
  
      }else{
                    alert("ajax error: " + thrown);
               }
  </code></pre>
  
  <p>now I make a jquery ajax reqeust like this:</p>
  
  <pre><code>$.post(url, {}, function(){}).fail(function(){})
  </code></pre>
  
  <p>in this example, as I declare a fail function, so I don't want the global ajaxError to be fired, but now the result is opposite, it is fired.
  and there is no <code>error</code> or <code>fail</code> attribute in <code>settings</code></p>