How to add JSONP support to a web service
I needed to do this yesterday, so that a developer could work on a project on his own machine while accessing some REST services I developed on an intranet server. Cross-domain requests are prohibited by the same origin policy security that govern client-side Javascript programs. JSONP gets around this by sending back a Javascript function which encloses the JSON data, rather than just the JSON data. This is known as a callback and is used like this:
$.getJSON("http://www.thing.com/services/webservice_json?callback=?",
{ "param" : "abc" },
…