JavaScriptMedium
Explain how JSONP works (and how it's not really Ajax)
By FrontendPro Editorial Team Updated 8/8/2026
#JavaScript
Answer
JSONP (JSON with Padding) is a technique used to overcome the same-origin policy in web browsers, allowing you to request data from a server on a different domain. It works by dynamically creating a <script> tag and setting its src attribute to the URL of the data source. The server responds with a script that calls a predefined callback function with the data as its argument. Unlike Ajax, JSONP does not use the XMLHttpRequest object and is limited to GET requests.
