Browser security prevents making an ajax call from a page hosted on one domain to a page hosted on a different domain; this is called the "same-origin policy".
- We can not get the data from third party website without jsonp.
- JSONP or "JSON with padding" is a communication technique used in JavaScript programs running in web browsers to request data from a server in a different domain, something prohibited by typical web browsers because of the same-origin policy.
- JSONP takes advantage of the fact that browsers do not enforce the same-origin policy on script tags.
- Note that for JSONP to work, a server must know how to reply with JSONP-formatted results.
- JSONP does not work with JSON-formatted results.
jqXHR → The jQuery XMLHttpRequest
JSONP is JSON with padding, that is, you put a string at the beginning and a pair of parenthesis around it. For example:
//JSON
{"name":"stackoverflow","id":5}
//JSONP
func({"name":"stackoverflow","id":5});
{"name":"stackoverflow","id":5}
//JSONP
func({"name":"stackoverflow","id":5});
Use Server Level : Node.js
Great Article
ReplyDeleteNode.js Project Topics for Computer Science
FInal Year Project Centers in Chennai
JavaScript Training in Chennai
JavaScript Training in Chennai