XMLHttpRequest.open() 方法中的错误函数不正确

Error incorrect function in XMLHttpRequest.open() method

我对本地 http 服务器进行了 ajax 调用,但 xmlhttp.open("GET", "http://localhost//push", true);IE 11 中出现错误函数,下面是我的完整代码:

var xmlhttp;
    if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp = new XMLHttpRequest();
    }
    else {// code for IE6, IE5
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange = function () {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
....some code.....
}}
    }
    xmlhttp.open("GET", "http://localhost//push", true);
    xmlhttp.send();
}

IE 使用 new XMLHttpRequest();

最后我得到了一个非常愚蠢的问题的答案,在 chrome 中 URL 可以是 "http://localhost//push" 但在 IE 中它应该有 反斜杠 而不是正斜杠 "http:\localhost\push" 否则它将显示 不正确的函数