title: Reporting syntax errors in a JSON object with jQuery and/or Javascript
body: <p>What the best way to report a syntax error when I'm loading a JSON feed with jQuery? I can establish the error reporting settings like this:</p>
  
  <pre><code>error: function(xhr){
      alert('Request Status: ' + xhr.status + ' Status Text: ' + xhr.statusText + ' ' + xhr.responseText);
  }
  </code></pre>
  
  <p>however this function doesn't fire when the URL I've called loads a valid page (albeit not one with a JSON object in it). Futhermore, I can't check the data that it does return because (according to Firebug at least) <code>jQuery.getJSON</code> breaks at the syntax error before it passes the object to the function that executes it.</p>
  
  <p>The reason I'd like to report errors is because this is my way of checking whether the user has supplied a URL that will produce a valid JSON feed.</p>
  
  <p>Here's a <a href="https://stackoverflow.com/questions/407596/how-do-you-handle-errors-from-ajax-calls">related answer that requires control over what the server will respond with</a>.
  Here's the syntax error that Firebug gives me
  <a href="http://img.skitch.com/20090623-8c97g47jha4mn6adqqtjd41cwy.jpg" rel="nofollow noreferrer">The syntax error Firebug gives me http://img.skitch.com/20090623-8c97g47jha4mn6adqqtjd41cwy.jpg</a></p>
  
  <p>Any ideas? Thanks</p>