Tag Archives: “No transport”

“bug” IE8 ajax 25253338169no transport

For example, I use the $. Ajax() method to request data. It works normally in modern browsers, but under IE 8, there will be an error: no transport

It is learned from stackoverflow that this problem occurs because * * IE 8 does not support cross origin restore share XHR * * requests, so it is not possible to request data across domains through native XHR or $. Ajax()

IE 8 implements its own set of methods: xdomainrequest

So I tried Google – “jQuery is compatible with IE 8 xdomainrequest”, and found a plug-in: jquery.xdomainrequest.min.js. Click download and directly reference it in the page to solve the problem (only IE8 and IE9 are supported)

Convert to IE9 below $. Ajax to return “no transport” across domains

Programmer algorithm practice must read, common Java API skills to share>>>

$.ajax({
            type: "POST",
            async: false,
            contentType: "application/x-www-form-urlencoded;charset=UTF-8",
            xhrFields: {
                withCredentials: true
            },
            url:url,
            data:data,
            success:function (response) {
                arr = response.Data.ListData;
            },
            error:function (XMLHttpRequest, textStatus, errorThrown) {
                alert(XMLHttpRequest.readyState);
                alert(textStatus);
            }
        });

  

The

code is as above. I thought it was a problem with the code, but later, I found that IE8 does not support CORS protocol, that is, access control allow origin: * added by background config

the solution is as follows:

Add jQuery. Support. CORS = true before $. Ajax

Or, add in $. Ajax

crossDomain:true,
dataType:'jsonp',
jsonp:'callback',

Original text https://blog.csdn.net/slzll/article/details/73175971