javascript-js cross-domain issues
伊谢尔伦
伊谢尔伦 2017-06-26 10:49:45
0
4
1037

This should be a cross-domain problem, but there is no problem on Google, Firefox, and ie10. The problem occurs on ie9-. It is said that if it is a cross-domain problem, there should be a prompt. I don’t know what the impact is. of?

 $.ajax({
        url: '//sh.uzai.com/ashx/ashx_ProductDetail.ashx?action=detail&pId=133689&_=1498273384086',
        type: 'GET',
        cache: false,
        dataType: "Json",
        async:false,
        success: function (data) {
            if (data != undefined) {
                jsonCData = data.calendarValue;
                jsonPData = data.priceValue;
                jsonShowDiscount = data.showDiscount;
            }
        },
        error: function (msg) {
           debugger;
        }
    });

ie9-The one that keeps entering is the debugger, please take a look at the reason

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(4)
大家讲道理

ie8 does not support cors

学霸

You can also use jsonp and background configuration

phpcn_u1582

Although IE8 and IE9 support cross-domain, they are not standard implementations of CORS. Instead, they rely on a non-standard implementation (CanIUse) of the XDomainRequest object. If the request library you use does not perform special compatibility processing for IE8 and IE9, it will Using the XMLHttpRequest object, cross-domain requests cannot be completed. If you want to be compatible with IE9, you can use the corresponding Polyfill library.

It is also worth noting that there are many restrictions on using the XDomainRequest object for cross-domain requests. For example, you can only initiate GET and POST requests, and you cannot modify the request header. For specific restrictions, please refer here.

小葫芦

In addition, if I use jsonp for processing, I get an error when I check the request. Do I need to configure json in the background?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template