Solution for access exceptions of cross-origin interfaces of IE8 Browser: domain interfaces of ie8 Browser

Source: Internet
Author: User

Solution for access exceptions of cross-origin interfaces of IE8 Browser: domain interfaces of ie8 Browser

Browsers earlier than IE8 are absolutely magical. They have been busy for a long time and everything is ready. They are actually exploding when ajax calls an interface.

Describe the problem

First, there is such an interface: Request type POST, input parameter JSON, output parameter JSON. The jQuery ajax call code is as follows:

Chrome works perfectly, but when we port the same code to IE8, the IE console tells me this.

Okay, it's also a headache for cross-origin problems. Okay. Now, we still use jsonp to solve this problem. However, the interaction method of jsonp must be modified to modify the interface type. OK, change POST to GET, and change it to jsonp. The ajax call code is as follows:

The IE console tells me this again, oh

Obviously, the returned values in the interface are not received. After checking the information, it turns out that the cross-origin function needs to be used to encapsulate the returned results, that is, the returned json string is returned as a function callback, below is the string returned by our final Interface

Callback ({"status": "0", "message": "OK "})

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.