--- title: Learn About Jsonp --- ## JSONP JSONP stands for "JSON with padding". Let's say you want to make AJAX requests to a different domain. Well, you can't do this with XMLHttpRequest, as you normally would, but you CAN do this with script tags, as seen [on StackOverflow](https://stackoverflow.com/questions/2067472/what-is-jsonp-all-about): ```javascript script = document.createElement('script'); script.type = 'text/javascript'; script.src = 'http://www.someWebApiServer.com/some-data'; ``` But this is ugly, now we have to get elements of a JSON out of a script tag, gross. Luckily, the creators of JSONP were thinking ahead, so instead of setting our scripts as we did above, we do this: ```javascript script.src = 'http://www.someWebApiServer.com/some-data?callback=my_callback'; ``` This triggers an automatic callback after the data has loaded, creating a function with the data desired inside of it. ### More Information: * Wikipidea/JSONP * JSONP and JQuery * More JSONP with JQuery * Ajax and JSONP