On Sep 3, 10:48 am, NATO24 <nat...@gmail.com> wrote:

> JDG, you're right, you cannot perform a XMLHttpRequest, but jQuery can
> load using the DOM script tag to get around it (using GET).  See the
> second "Note:"http://docs.jquery.com/Ajax/jQuery.ajax#options

For the curious, essentially this is done by appending a <script> tag
to the <head> element of the current document, something like this:

<script type="text/javascript" src="http://twitter.com/statuses/
user_timeline/some_user_id.json?callback=someCallback"></script>

The browser sees this new script tag (more accurately a DOM event
fires), goes and gets it, and Twitter returns something like this:

<script type="text/javascript">someCallback([some data])</script>
causing a call to someCallBack() with the data from the API call,
which runs in the browser.

Cool, huh?

(I can't promise this is how jQuery does it - but this is how I do
it.)

Reply via email to