title: jQuery ajax success callback not firing
body: <p>I'm using jQuery's <code>$.ajax</code> method to fetch data from a JSONP-compatible web service and as far as getting a response and displaying the received data in my HTML, everything seems to be working fine. However, I haven't been able to get the ajax method's success callback to fire. What's even stranger is that even when I do get a valid response from the service, the error callback is always fired.</p>
  
  <p>Here is an example of a simple js function I made to test this:</p>
  
  <pre><code>function doJsonp()
  {
      $.ajax({
          url: "http://example.com/api/service?callback=blah",
          dataType: "jsonp",
          crossDomain: true,
          success: function() { console.log("success"); }, // This is never fired
          error: function() { console.log("error"); } // This is always fired
      });
  }
  </code></pre>
  
  <p>and the matching callback function:</p>
  
  <pre><code>function blah(data)
  {
      console.log(data); // This is called properly
  }
  </code></pre>
  
  <p>From reading similar questions here on SO and elsewhere, it seems that this is most often caused by the service returning JSON that does not validate. For my purposes, I am using an in-house web service but have tried other JSONP services as well, such as those provided by Flickr, for example:</p>
  
  <p><a href="http://api.flickr.com/services/feeds/groups_pool.gne?id=807213@N20&amp;lang=en-us&amp;format=json&amp;jsoncallback=blah">http://api.flickr.com/services/feeds/groups_pool.gne?id=807213@N20&amp;lang=en-us&amp;format=json&amp;jsoncallback=blah</a></p>
  
  <p>Both the JSON from Flickr's service and mine validate using jsonlint so that does not seem to be the issue as far as I can tell.</p>
  
  <p>In searching for solutions to this problem, I have tried using a jQuery plugin called jquery-jsonp, found at <a href="http://code.google.com/p/jquery-jsonp/">http://code.google.com/p/jquery-jsonp/</a>. This replaces jQuery's <code>$.ajax</code> call with its own <code>$.jsonp</code> so the above code looks like this:</p>
  
  <pre><code>function doJsonp()
  {
      $.jsonp({
          url: "http://example.com/api/service?callback=blah",
          success: function() { console.log("success"); },
          error: function() { console.log("error"); }
      });
  }
  </code></pre>
  
  <p>However, the result is the same and the success callback never fires. Any help or a nudge in the right direction would be greatly appreciated!</p>