title: JSONP Callback function
body: <p>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. </p>
  
  <p>So, I uploaded one json file to the server - <a href="http://abhishekprakash.com/script/example.json" rel="nofollow noreferrer">json file</a></p>
  
  <p>And here is the js code which I wrote to retrieve the data. The call is made from localhost to the abhishekprakash.com.</p>
  
  <pre><code>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);
      }
  };
  </code></pre>
  
  <p>And this is the response that I get in the console:</p>
  
  <p><img src="https://i.stack.imgur.com/FPbyP.png" alt="snap shot of console"></p>
  
  <p>The callback function is called but it does not contain the Json data.
  What am I missing?</p>
  
  <p>Any help is appreciated.</p>
  
  <p>Thanks</p>