I noticed that some websites (for example: apple.com or disqus.com) don’t send AJAX request to load, for example, live search results. Instead they attach new JS script, that holds all results in a variable.
To be more specific. If you go to apple.com and type “test” into the searcher. It won’t send an AJAX request to get the results, instead it will add < script src=”some.addres.apple.com/result.js?q=test” > to the HTML and execute new piece of JS script to bring in the search results.
improvement
Are they doing this only because you can’t send AJAX request to a different domain, or is there any speed improvement possible?
There is a lot of discussion online of the “hackishness” of JSONP:
I have found it to be extremely useful in getting around cross-domain security limitations but I have not seen nor have I heard of any speed improvements.
I highly recommend learning more about JSONP (especially when it is useful/necessary).