XDomainRequest unspecified error in ie8

落爺英雄遲暮 提交于 2019-12-24 07:26:52

问题


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();

来源:https://stackoverflow.com/questions/43855467/xdomainrequest-unspecified-error-in-ie8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!