title: How can Firebug parse an invalid JSONP response?
body: <p>So I'm just trying out Jersey Jax-rs web services for the first time, and I've made the simplest GET method imaginable.</p>
  
  <p>I've also created an AJAX function to call the web service.  Now if I set the <code>dataType</code> property to <code>json</code>, I get the expected 'cross domain' error, and that's fine.  </p>
  
  <p>However, when I changed <code>dataType</code> to <code>jsonp</code>, I was surprised to see that Firebug was able to parse the string ("Reply from webservice"), which was sent by the web service, even though it was not formatted correctly for JSONP, and show it in its <em>Console</em> panel.</p>
  
  <p>So if Firebug can parse invalid JSONP (and I would have thought it shouldn't be able to), how come AJAX can't seem to parse it as well? If I stringify the data received by the AJAX call, all I can see is,</p>
  
  <pre><code>{"readyState":4,"status":200,"statusText":"success"}
  </code></pre>
  
  <p>Here's my code for greater context.</p>
  
  <p><strong>Jersey Web Service</strong></p>
  
  <pre><code>@GET
  @Path("getJson")
  @Produces("application/json")                     
  public String getJson()
  {
    return "Reply from Webservice";  
  }
  </code></pre>
  
  <p><strong>Javascript Ajax</strong></p>
  
  <pre><code>function accessWebService()
  {
  
    var query = "http://localhost:8080/test_webservice/webresources/test/getJson";
  
    $.ajax
    ({
        type: 'GET',
        url: query,
        dataType: 'jsonp',        
        async: true,
        timeout: 10000,
        jsonpCallback: call,
        complete: function(data) 
        { 
          console.log(JSON.stringify(data));
        }
    });
  
  }
  
  function call(data)
  {
    console.log("jsonp");
  }
  </code></pre>
  
  <p><strong>Firebug Console Output</strong></p>
  
  <pre><code>{"readyState":4,"status":200,"statusText":"success"}
  
  SyntaxError: missing ; before statement
  "Reply from Webservice"
  </code></pre>