JSONP VS JSON - What's the difference? Explained with examples

JSONP is just JSON wrapped in a callback function.

JSONP is useful for making cross domain requests, which are often otherwise forbidden by browsers for security reasons.

 // an example of JSON

 // an example of JSONP

Then to access the data stored in your JSONP, you define the callback function:

myCallback = function(data){
1 Like