本文介紹了NETWORK_ERR:XMLHttpRequest 異常 101的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我在 Chrome 中遇到 AJAX 問題,出現以下錯誤:
I'm having an AJAX problem in Chrome, giving the following error:
Uncaught Error: NETWORK_ERR: XMLHttpRequest Exception 101
這是我的代碼:
function IO(filename) {
if (window.XMLHttpRequest) { // Mozilla, Safari,...
xmlhttp = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) { }
}
}
xmlhttp.open("GET", filename+"?random="+Math.floor(Math.random()*100000001), false);
xmlhttp.send();
if(xmlhttp.readyState==4)
return xmlhttp.responseXML;
}
推薦答案
解決方案是將 async
參數設置為 true
:
The solution is setting the async
parameter to true
:
xmlhttp.open("GET", filename+"?random="+Math.floor(Math.random()*100000001), true);
這篇關于NETWORK_ERR:XMLHttpRequest 異常 101的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!