I was looking into the concept of JSONP callback function. I read some articles regarding that and wanted to get a good grasp of the concept of JSONP.
So, I uploaded one json file to the server - json file
And here is the js code which I wrote to retrieve the data. The call is made from localhost to the abhishekprakash.com.
var xhr; var dataList; xhr = new XMLHttpRequest(); xhr.open('GET', 'http://abhishekprakash.com/script/example.json?callback=func_callbk', true); xhr.send(); func_callback = function(data){ alert(data.data.people[0].id); } xhr.onreadystatechange = function(){ if(xhr.readyState == 4){ console.log(dataList); } }; And this is the response that I get in the console:

The callback function is called but it does not contain the Json data. What am I missing?
Any help is appreciated.
Thanks
onreadystatechangeor thefunc_callback? Seems that your response is JSON, not JSONP, so I can't see how thefunc_callbackwould be invoked.