title: Ideal way to find out if response is JSON during ajaxSuccess
body: <p>In my $.ajaxSucess() function I need to find out if the response is json. Currently I am doing this:</p>
  
  <pre><code>$('body').ajaxSuccess(function(evt, xhr, settings) {
      var contType = xhr.getAllResponseHeaders().match(/Content-Type: *([^)]+);/);
      if(contType &amp;&amp; contType.length == 2 &amp;&amp; contType[1].toLowerCase() == 'application/json'){    
  ...
  </code></pre>
  
  <p>Is there a better way?</p>