title: Why does this cross-domain request workaround work?
body: <p>In <a href="http://ejohn.org/blog/dictionary-lookups-in-javascript/" rel="nofollow">this John Resig article</a>, he's is dealing with a dictionary-sized list of words with javascript, and he's loading the content via ajax from a CDN.</p>
  
  <p>The words are loaded in with newlines separating the words. Then he says cross domain fails:</p>
  
  <blockquote>
    <p>There's a problem, though: We can't load our dictionary from a CDN!
    Since the CDN is located on another server (or on another sub-domain,
    as is the case here) we're at the mercy of the browser's cross-origin
    policy prohibiting those types of requests. All is not lost though -
    with a simple tweak to the dictionary file we can load it across
    domains.</p>
    
    <p>First, we replace all endlines in the dictionary file with a space.
    Second, we wrap the entire line with a JSONP statement. Thus the final
    result looks something like this:</p>
    
    <p>dictLoaded('aah aahed aahing aahs aal... zyzzyvas zzz');</p>
    
    <p>This allows us to do an Ajax request for the file and have it work as
    would expected it to - while still benefiting from all the caching and
    compression provided by the browser.</p>
  </blockquote>
  
  <p>So, if I'm reading this correctly, simply adding his method <code>dictLoaded('original content')</code> around the original content alone causes the ajax request to not fail.</p>
  
  <p>Is that (turning it into a function + param) really all it takes? and why does JSONP solve the problem of cross domain access restriction?</p>