Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
For certain kinds of content, a <script> element can be used as a useful
alternative to XMLHttpRequest. Simply set the src attribute of a <script> (and insert it into the document
if it isn’t already there) and the browser will generate an HTTP request
to download the URL you specify. <script> elements are useful Ajax
transports for one primary reason: they are not subject to the same-origin
policy, so you can use them to request data from servers other than your
own.
The technique of using a <script> element as an Ajax transport has
come to be known as JSONP: it works when the response body of the HTTP
request is JSON-encoded. The “P” stands for “padding” or “prefix”—this
will be explained in a moment.