JSONP for cross-site Callbacks
Posted by: Rick Strahls WebLog,
on 04 Jul 2007 |
View original
Here's the JSONP code that uses the code I mentioned in my last post. JSONP is an unofficial protocol that allows making cross domain calls by generating script tags in the current document and expecting a result back to calls a specified callback handler. The client JavaScript code to make a JSONP call looks like this:function jsonp(url,callback,query)
{
if (url.indexOf("?") > -1)
url += "&jsonp="
else
url += "?jsonp="
url += callback["name"] + "&";
...