title: Intercept all ajax calls?
body: <p>I'm trying to intercept all AJAX calls in order to check if that AJAX response contains specific error code that I send as JSON from my PHP script (codes: ACCESS_DENIED, SYSTEM_ERROR, NOT_FOUND).</p>
  
  <p>I know one can do something like this:</p>
  
  <pre><code>$('.log').ajaxSuccess(function(e, xhr, settings) {
  });
  </code></pre>
  
  <p>But  - does this work only if "ajaxSuccess" event bubble up to .log div? Am I correct? Can I achieve what I want by binding "ajaxSuccess" event to document?</p>
  
  <pre><code>$(document).ajaxSuccess(function(e, xhr, settings) {
  });
  </code></pre>
  
  <p>I can do this in either jQuery or raw JavaScript.</p>