XDomainRequest unspecified error in ie8

2019-08-02 04:10发布

I am trying to make a http GET request in IE8. This works fine in all other browsers and in IE8 when using jQuery but not the native method. I also tried another endpoint I have but no luck. All it returns is 'Unspecified error.' in the console on the xdr.send() line.

var xdr = new XDomainRequest();
xdr.open("get", 'http://localhost/jump/test');
xdr.onload = function () {
  alert("Loading");
  alert(xdr.responseText);
};
xdr.onsuccess = function() {
  alert("Success!");
  alert(xdr.responseText);
};
xdr.onerror = function() {
  alert("Error!");
  alert(xdr.responseText);
};
xdr.onprogress = function() {
  alert("Progress");
  alert(xdr.responseText);
};
xdr.timeout = 10000;
xdr.send();

0条回答
登录 后发表回答