top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

What is JSONP and how to use it?

0 votes
39 views
What is JSONP and how to use it?
posted Jul 9, 2017 by Shyam Chakraborty

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

JSONP stands for JSON with padding. It is a method used to bypass the cross-domain policies in web browsers. In other words, JSONP is the simple way to deal with browser restrictions when sending JSON responses from different domains from the client.

Example

$.ajax({
  //JSONP API
  url: "http://remote.domain.com/data/?callback=jsonpcallback&id=123",
  //the name of the callback function
  jsonp: "jsonpcallback",
  //tell jQuery to expect JSONP
  dataType: "jsonp",
  //tell YQL what we want and that we want JSON
  data: {
    id: "123"
  },
  //work with the response
  success: function(data) {
    console.log(data); //formatted JSON data
  }
});
answer Jul 11, 2017 by Debaprasad Maity
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...