1

Script.js:

var request = new XMLHttprequest(); 

request.open('GET','data.txt',false);   

if(request.status===200) {   
    console.log(request);   
    document.writeln(request.responseText);
}

これは私のjavascriptファイルです。このエラーが発生しています:

キャッチされない参照エラー: XMLHttprequest が定義されていません

助けてください。

心から感謝します。

4

4 に答える 4

0
    try {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");//this is for ie
    } catch (e) {
            try {
                  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");//this is for ie
                 } catch (E) {
                         try{
                              xmlhttp =new XMLHttpRequest();//for browsers other than ie
                    }
                 catch(e)
                 {

                 }
                }

XMLHttpRequest のようなブラウザでは動作しません

于 2013-04-30T06:53:06.050 に答える