<script src="https://api.example.com/data?callback=myCallback"></script>
{
"name": "John",
"age": 30
}How JSONP Works
JSONP (JSON with Padding) is a technique used to bypass cross-origin policy limitations in browsers. It works by:
- Creating a script tag with a URL that includes a callback parameter
- The server wraps the JSON response in the callback function
- The browser executes the script, calling the callback with the data