Harvard Extension School
CSCI E-12 Fundamentals of Web Site Development | Fall 2019

## JSONP

Note: the JSONP technique pre-dates CORS. JSONP is still in use, but CORS is the preferred approach.

With JSONP, a new "script" element is dynamically created (no restrictions on cross-origin requests for "script" elements), and the JSON returned is wrapped in a function, which you can then call to get the JSON. Since the JSON is wrapped in a function, the "P" is for the "padding". So depending on your perspective, JSONP exploits a back-door to the cross-origin issue, or it is a clever solution to the cross-origin issue.

Copyright © David Heitmeyer