相关疑难解决方法(0)

XMLHttpRequest在IE 7/8中不起作用,但在其他浏览器中起作用

我开发了一个适用于chrome和firefox的web应用程序.但是,当涉及到测试时间并且它在IE中无法正常工作时.它似乎没有真正得到请求?

这是Javascript代码:

function createXMLHttpRequest() {
    var xmlhttp = false;
    if (window.XMLHttpRequest) {
        xmlhttp = new XMLHttpRequest();
    } else if(window.ActiveXObject) {
        try {
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                xmlhttp = false;
            }
        }
    }
    return xmlhttp;
};




function checkForData(){

    var target = document.getElementById('accordion');
    var loading = document.getElementById('controls');

    var xhr = createXMLHttpRequest();


    loading.innerHTML = '<img src="../images/loading.gif" width=20 height=20 />Querying the Database';

    xhr.open('GET','getData.php',true);
    xhr.send(null); 

    xhr.onload = function(){
        loading.innerHTML = '<a …
Run Code Online (Sandbox Code Playgroud)

javascript php xmlhttprequest internet-explorer-8 internet-explorer-7

7
推荐指数
1
解决办法
6414
查看次数