title: How do I catch jQuery $.getJSON (or $.ajax with datatype set to 'jsonp') error when using JSONP?
body: <p>Is it possible to catch an error when using JSONP with jQuery? I've tried both the $.getJSON and $.ajax methods but neither will catch the 404 error I'm testing. Here is what I've tried (keep in mind that these all work successfully, but I want to handle the case when it fails):</p>
  
  <pre><code>jQuery.ajax({
      type: "GET",
      url: handlerURL,
      dataType: "jsonp",
      success: function(results){
          alert("Success!");
      },
      error: function(XMLHttpRequest, textStatus, errorThrown){
          alert("Error");
      }
  });
  </code></pre>
  
  <p>And also:</p>
  
  <pre><code>jQuery.getJSON(handlerURL + "&amp;callback=?", 
      function(jsonResult){
          alert("Success!");
      });
  </code></pre>
  
  <p>I've also tried adding the $.ajaxError but that didn't work either:</p>
  
  <pre><code>jQuery(document).ajaxError(function(event, request, settings){
     alert("Error");
  });
  </code></pre>
  
  <p>Thanks in advance for any replies!</p>