search

Home  >  Q&A  >  body text

javascript-js cross-domain issues

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

伊谢尔伦伊谢尔伦2764 days ago1035

reply all(4)I'll reply

  • 大家讲道理

    大家讲道理2017-06-26 10:51:45

    ie8 does not support cors

    reply
    0
  • 欧阳克

    欧阳克2017-06-26 10:51:45

    You can also use jsonp and background configuration

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-06-26 10:51:45

    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.

    reply
    0
  • 高洛峰

    高洛峰2017-06-26 10:51:45

    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?

    reply
    0
  • Cancelreply