为什么在Windows 10、ie、Angular 1.5.8中有一个“;“拒绝访问”;XMLHttpRequest xhr.open(';post';,';http://localhost';正确)

为什么在Windows 10、ie、Angular 1.5.8中有一个“;“拒绝访问”;XMLHttpRequest xhr.open(';post';,';http://localhost';正确),angular,internet-explorer,xmlhttprequest,windows-10,angular-routing,Angular,Internet Explorer,Xmlhttprequest,Windows 10,Angular Routing,为Angular 1.5.8开发一个程序 当从剪贴板加载和粘贴页面时,以及出于某种原因,当加载正常时,会触发相同的函数,但当您在IE(其他浏览器工作)中从windows 10的剪贴板粘贴到函数XMLHttpRequest xhr.open的开头时(“put”,“true”); 我给出错误“无效参数” 当我做角度包裹时,会出现错误“拒绝访问” plant.query( 错误:访问被拒绝 在匿名函数(Oh.min.js?ver=0.6.6688.17819:125:278)在匿名函数(Oh.min.

为Angular 1.5.8开发一个程序

当从剪贴板加载和粘贴页面时,以及出于某种原因,当加载正常时,会触发相同的函数,但当您在IE(其他浏览器工作)中从windows 10的剪贴板粘贴到函数XMLHttpRequest xhr.open的开头时(“put”,“true”); 我给出错误“无效参数” 当我做角度包裹时,会出现错误“拒绝访问” plant.query( 错误:访问被拒绝

在匿名函数(Oh.min.js?ver=0.6.6688.17819:125:278)在匿名函数(Oh.min.js?ver=0.6.6688.17819:122:53)在匿名函数(Oh.min.js?ver=0.6.6688.17819:119:255)在匿名函数(Oh.min.js?ver=0.6.6688.17819:154:10)在m.prototype.在匿名函数(Oh.min.js.js?ver=0.6.6688.17819:165:255)在m.prototype.应用$eval($336)(:111)在匿名函数(Oh.min.js?ver=0.6.6688.17819:299:245)在w.event.dispatch(:41706)在y.handle(Oh.min.js?ver=0.6.6688.17819:2:39718)

函数planttetst(){
控制台日志(“аазазааазааааа1072;
var xhr=new XMLHttpRequest();
xhr.open('put','http://localhost:62631/api/PlantConsignee/",对),;
setRequestHeader('Content-Type','application/json;charset=utf-8');
var inp=JSON.stringify({“pageNumber”:1,“pageSize”:9999,“Count”:9999,“Items”:[{“Id”:1,“PlantCode”:“**”,“Code”:“BP00016238”}]);
xhr.send(inp);
xhr.onreadystatechange=函数(){
var response=xhr.responseText;
console.log(“ззааааааа”+response.toString());
}
查询({“pageNumber”:1,“pageSize”:9999,“Count”:9999,“Items”:[{“Id”:1,“PlantCode”:“**”,“Code”:“BP00016238”}])。$promise.then(函数(响应){
console.log(“新日期”);
警惕(“超级”);
}).catch(函数(原因){
notifyService.error(“原因===未定义的原因===空的原因.数据===未定义的”):“原因.数据.消息”+”;
});

}
我通过对原始AJAX调用使用setTimeout()解决了这个问题。例如:

setTimeout(function() {
    XMLHttpRequest xhr.open('put', 'http://localhost:62631/api/PlantConsignee/', true);
}, 1);
我假设这是IE中的某种bug。只需要1毫秒就可以了

非常有助于回答这个问题

angular.module('publicApp').factory('Document',function($resource){return.factory('plant收货人',function($resource){return$resource('api/plant收货人/:id',{},{query:{method:'PUT',url:'api/plant收货人/PUT'}});})