title: Are there reasons not to use JSONP for AJA~X requests?
body: <p>If you're building an <code>AJA~Xy</code> app, are there any downsides to using <code>JSONP</code> requests/responses even if you're not planning on any <code>cross-domain</code> requests? </p>
  
  <p>The only thing I can think of is that there are a couple extra bytes for the callback wrapper... </p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I found <a href="http://remysharp.com/2007/10/08/what-is-jsonp/" rel="nofollow noreferrer">this</a> which also suggests <code>security and error handling</code> as potential problems... </p>
  
  <blockquote>
    <p>There's no error handling. The <code>script injection</code> either works, or it doesn't.
    If there's an error from the <code>injection</code>, it'll hit the page, and short of a window wide error handler (bad, bad, very bad), you need to be sure the return value is valid on the <code>server side</code>.</p>
  </blockquote>
  
  <p>I don't think <code>error handling</code> is much of a problem... most of us would use a library to generate the <code>JSON</code>... the well-formedness of my response isn't a concern for this question.</p>
  
  <p><strong>and security:</strong></p>
  
  <blockquote>
    <p>There are documents out on the web that can help, but as a cursory check, I would check the referrer in the <code>server side</code> script.</p>
  </blockquote>
  
  <p>it seems like this is a potential problem with any type of response... certainly, there's nothing unique to <code>JSONP</code> in the security arena...?</p>