title: Why isn't jQuery automatically appending the JSONP callback?
body: <p>The <a href="http://api.jquery.com/jQuery.getJSON/" rel="nofollow noreferrer"><code>$.getJSON()</code></a> documentation states:</p>
  
  <blockquote>
    <p>If the specified URL is on a remote server, the request is treated as JSONP instead. See the discussion of the <code>jsonp</code> data type in $.ajax() for more details.</p>
  </blockquote>
  
  <p>The <a href="http://api.jquery.com/jQuery.ajax/" rel="nofollow noreferrer"><code>$.ajax()</code></a> documentation for the <code>jsonp</code> data type states (emphasis mine):</p>
  
  <blockquote>
    <p>Loads in a JSON block using JSONP. <strong>Will add an extra "?callback=?" to the end of your URL to specify the callback</strong>.</p>
  </blockquote>
  
  <p>So it seems that if I call <code>$.getJSON()</code> with a cross-domain URL, the extra "callback=?" parameter should automatically get added. (Other parts of the documentation support this interpretation.)</p>
  
  <p>However, I'm not seeing that behavior. If I don't add the "callback=?" explicitly, jQuery incorrectly makes an XMLHttpRequest (which returns null data since I can't read the response cross-domain). If I do add it explicitly, jQuery correctly makes a &lt;script&gt; request.</p>
  
  <p>Here's an example:</p>
  
  <pre><code>var URL = "http://www.geonames.org/postalCodeLookupJSON" +
      "?postalcode=10504&amp;country=US";
  
  function alertResponse(data, status) {
    alert("data: " + data + ", status: " + status);
  }
  
  $.getJSON(URL, alertResponse);
  // alerts "data: null, status: success"
  
  $.getJSON(URL + "&amp;callback=?", alertResponse);
  // alerts "data: [object Object], status: undefined"
  </code></pre>
  
  <p>So what's going on? Am I misunderstanding the documentation or forgetting something?</p>
  
  <p>It goes without saying that this isn't a huge deal, but I'm creating a web API and I purposely set the callback parameter to "callback" in the hopes of tailoring it nicely to jQuery usage.</p>
  
  <p>Thanks!</p>
  
  <p>(Edit: I <a href="http://forum.jquery.com/topic/getjson-isn-t-automatically-appending-callback-to-my-cross-domain-url" rel="nofollow noreferrer">cross-posted this</a> in the jQuery forums if you're interested.)</p>