WebSite/JS/Ajax.js

(开头部分) 2KB

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

/**
*     封装Ajax 传输类
*     URL:传过去处理的页面地址
*    callBackFunction:成功后调用的方法
*    errorFunction:失败后调用的方法
*    用法: var mAjaxer = new Ajaxer("url",callBackFunction,errorFunction)
*                 mAjaxer.send();
*  by:李涛
*/
var Ajaxer = function(URL, callBackFunction, errorFunction) {
    this.AjaxMethod = "POST";                            //默认传输方式 POST;
    this.SendObject = null;                                //传输的内容,默认null    
    this.ResponseType = "Text";                        //返回值类型
    this.Async = true;                                       //是否异步方式

    function createXMLHttp() {
        var xmlhttp;
        try {
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (ex) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (ex) {
                xmlhttp = new XMLHttpRequest();
            }
        }
        return xmlhttp;
    }

    var xmlHttp;

    this.send = function() {
        xmlHttp = null;
        xmlHttp = createXMLHttp();
        if (xmlHttp == null) {
            alert("创建xmlHTTP失败!");
        } else {
            xmlHttp.onreadystatechange = this.SendBack;
            xmlHttp.open(this.AjaxMethod, URL, this.Async);
            xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            xmlHttp.send(this.SendObject);
        }
    }

    this.SendBack = function() {
        if (xmlHttp.readyState == 4) {
            if (xmlHttp.status == 200) {
                var res;
                res = xmlHttp.responseText;
                callBackFunction(res);
            } else {
            var error = eval(error + "=" + "{\"code\":\"" + xmlHttp.status + "\",\"message\":\"" + xmlHttp.statusText + "\"}");
                errorFunction(error);
            }
        }
    }
}

//单击复选框时那个选中
function SelectAll(tempControl, gridname) {
后面还有 13 行代码,购买后查看完整代码

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

AI 解读 AI

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

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