5

Using JSON to Solve Cross Domain Problems

 2 years ago
source link: https://www.codesd.com/item/using-json-to-solve-cross-domain-problems.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Using JSON to Solve Cross Domain Problems

advertisements

JavaScript-based AJAX seemed a good approach until we hit the limitation of AJAX clients only being able to communicate to the server from where they are downloaded, thus adhering to the "same origin policy."

Could anybody please tell me how can a JSON could solve this cross domain problem , as in my knowledge JSON is only a data format saying how the data can be presented .

Please give your advices on this My question is how an XMLHttprequest is controlled by a data format of different structure


See JSONP on Wikipedia:

JSONP or "JSON with padding" is a complement to the base JSON data format, a pattern of usage allowing a page to request data from a server in a different domain. JSONP is a solution to this problem, forming an alternative to a more recent method called Cross-Origin Resource Sharing.

The server then wraps its JSON response with this prefix, or "padding", before sending it to the browser. When the browser receives the wrapped response from the server it is now a script, rather than simply a data declaration.

Tags ajax

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK