Meeting/Html/css/ajax.js

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/**
*
* 手写 ajax 方法
*
**/
if (window.ActiveXObject && !window.XMLHttpRequest) {
    window.XMLHttpRequest = function() {
    var msxmls = ['Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP', 'Microsoft.XMLHTTP'];
        for (var i = 0; i < msxmls.length; i++) {
            try {
                return new ActiveXObject(msxmls[i]);
            } catch (e) { }
        }
        return null;
    };
}

// XMLHttpRequest 对象
var xmlHttp;

// 创建一个XMLHTTP对象,兼容不同的浏览器
function getAjax() {
    return new XMLHttpRequest;
}

// 提交 Ajax --- GET 方式,返回 Text
function AjaxByGET(url, callback) {
    xmlHttp = getAjax();
    if (xmlHttp != null) {
        xmlHttp.open("GET", url, true);
        xmlHttp.onreadystatechange = function() {
            //alert("readyState=\t" + xmlHttp.readyState + "\nstatus=\t" + xmlHttp.status + "\nresponseText=\t" + xmlHttp.responseText);
            if (xmlHttp.readyState == 4) {
                if (xmlHttp.status == 200) {
                    var responseValue = xmlHttp.responseText;
                    //eval(callback + '("' + responseValue + '")');
                    callback(responseValue);
                }
            }
        };
        xmlHttp.send(null);
    }
}

// 提交 Ajax --- GET 方式,返回 XML
function AjaxViaXml(url, callback) {
    xmlHttp = getAjax();
    if (xmlHttp != null) {
        xmlHttp.open("GET", url, true);
        xmlHttp.onreadystatechange = function() {
            //        alert("readyState=\t" + xmlHttp.readyState + "\nstatus=\t" + xmlHttp.status + "\nresponseText=\t" + xmlHttp.responseText);
        if (xmlHttp.readyState == 4) {
                if (xmlHttp.status == 200) {
                    var responseValue = xmlHttp.responseXML;
                    //eval(callback + '(' + responseValue + ')');
                    callback(responseValue);
                }
            }
        };
        xmlHttp.send(null);
后面还有 27 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。