JQuery cross-Origin

Source: Internet
Author: User

I recently encountered a problem with cross-origin access. I have studied it for a long time and found a lot of information on the Internet to find out what cross-origin access is, cross-origin means that the current page and the accessed page are not under the same domain name and are restricted by the same-origin policy of the browser. The same-origin means that the domain name, protocol, and port must be consistent; the same-origin policy means that scripts on the page cannot access resources of different sources (including HTTP responses and cookies). How can we achieve cross-origin access?

Jquery provides us with several methods:

Post: Cross-origin access is not allowed, and the browser does not;

Get: Cross-origin access is implemented. We found that it is normal in IE and 360 today, but it cannot return results in Google and FF. I don't know why;

GetJSON: Cross-origin access is supported. However, from the information found, This method requires defining a callback parameter on both the client and server;

Ajax: This method is the same as getJSON;

Jsonp: This method is the same as getJSON;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.