Dojo Grid结合Ajax用法

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CustomerDefinedOutputField.aspx.cs" Inherits="SparkBiz.Payroll.CustomerDefinedOutputField" %>
<style>
       @import "../public/prod1.5.37.1/dojo1.5/dijit/themes/claro/claro.css";
	   @import "../public/prod1.5.37.1/dojo1.5/dijit/themes/soria/soria.css";
	   @import "../public/prod1.5.37.1/dojo1.5/dijit/themes/nihilo/nihilo.css";
	   @import "../public/prod1.5.37.1/dojo1.5/dijit/themes/tundra/tundra.css";
	   @import "../public/prod1.5.37.1/dojo1.5/dojo/resources/dojo.css";
	   @import "../public/prod1.5.37.1/dojo1.5/dojox/grid/enhanced/resources/claroEnhancedGrid.css";
	   @import "../public/prod1.5.37.1/dojo1.5/dojox/grid/enhanced/resources/EnhancedGrid_rtl.css";
	   @import "../public/prod1.5.37.1/dojo1.5/dijit/themes/claro/document.css";         

       #gridList
       {
            width:100%;
            height:556px;
            border:1px solid silver;
       }
    .spanClass {
        color:red
    }
</style>

<div id="ListRoot" style="position:absolute; top:20px; width:100%;">
</div>
<script src="Modules/Payroll/JS/json2.js" type="text/javascript"></script>
<script type="text/javascript">
    dojo.require("dijit.layout.SplitContainer");
    dojo.require("dijit.layout.ContentPane");
    dojo.require("revit.form.Button");
    dojo.require("dojox.grid.DataGrid");
    dojo.require("dojo.data.ItemFileWriteStore");
    dojo.require("dojo.parser");
</script>

<%--Group类别样式--%>
<style type="text/css">
    #ulGroup
    {
        font:12px verdana, arial, sans-serif;
    }
    #ulGroup li a
    {
        display:block;
        padding:8px 20px;
        text-decoration:none;
    }
    #ulGroup li a:hover
    {
        background:#4aabbe;
        color:#fff;
        text-decoration:none;
    }
</style>
<%--构造列结构以及绑定控件事件--%>
<script type="text/javascript">
    var gridCells =
    [
        {
            field: "PRBatchFieldName",
            name: "<%=RM.GetString("HeadDefinedYlX") %>",
            width: "200px"
        },
        {
            field: "TableName",
            name: "<% = RM.GetString("TableName") %>",
            formatter: SetTablesHtml,
            width: "170px"
        },
        {
            field: "FieldName",
            name: "<% = RM.GetString("FieldName") %>",
            formatter: SetFilesHtml,
            width: "300px"
        },
        {
            field: "LookUpField",
            name: "LookUp",
            formatter: SetLookUpHtml,
            width: "200px"
        }
    ];

    //设置TableName样式
    function SetTablesHtml(value, rowIndex) {
        var grid = dijit.byId("gridList");
        var index = grid.store.getValue(grid.getItem(rowIndex), "Index");
        value = datas.items[index].TableName;
        var selTabName = datas.items[index].selTabName;
        var GroupName = datas.items[index].GroupName;
        var innerHtml = "";
        var array = value.toString().split(",");
        if (GroupName == "Defined") {
            innerHtml += "<select id=‘selTab" + index + "‘ style=\"width:100%;\;font-family:Tahoma;font-size:11px\" onchange=\"selectTable_onchange_click(this,‘" + index + "‘)\">";
            for (var i = 0; i < array.length; i++) {
                var selStr = "";
                if (array[i] == selTabName)
                    selStr = "selected=selected";
                innerHtml += "<option " + selStr + " value = ‘" + array[i] + "‘>" + array[i] + "</option>";
            }
            innerHtml += "</select>";
        }
        else {
            gridCells[0].width = "200px";
            innerHtml += "<span style=\"width:100%\">";
            innerHtml += array[0];
            innerHtml += "</span>";
        }
        return innerHtml;
    }

    //设置Filed样式
    function SetFilesHtml(value, rowIndex) {
        var grid = dijit.byId("gridList");
        var index = grid.store.getValue(grid.getItem(rowIndex), "Index");
        value = datas.items[index].FieldName;
        var selFieldName = datas.items[index].SelFieldName;
        var GroupName = datas.items[index].GroupName;
        var innerHtml = "";
        var array = value.toString().split(",");
        if (GroupName == "Defined") {
            innerHtml += "<select id=‘selField" + index + "‘ style=\"width:100%;\font-family:Tahoma;font-size:11px\" onchange=\"selectField_onchange_click(this,‘" + index + "‘)\">";
            for (var i = 0; i < array.length; i++) {
                var selStr = "";
                if (array[i].split("/")[0] == selFieldName)
                    selStr = "selected=selected";
                innerHtml += "<option " + selStr + " value = ‘" + array[i] + "‘>" + array[i] + "</option>";
            }
            innerHtml += "</select>";
        }
        else {
            innerHtml += "<span style=\"width:100%\">";
            innerHtml += array[0];
            innerHtml += "</span>";
        }
        return innerHtml;
    }

    //设置LookUp样式
    function SetLookUpHtml(value, rowIndex) {
        var grid = dijit.byId("gridList");
        var index = grid.store.getValue(grid.getItem(rowIndex), "Index");
        value = datas.items[index].LookUpField;
        var selLookup = datas.items[index].selLookup;
        var GroupName = datas.items[index].GroupName;
        var array = value.toString().split(",");
        var innerHtml = "";
        if (GroupName == "Defined") {
            if (selLookup == "") {
                innerHtml += "<select id=‘sellookup" + index + "‘ style=\"width:100%;\font-family:Tahoma;font-size:11px;display:none\" onchange=\"selectLookUp_onchange_click(this,‘" + index + "‘)\">";
            }
            else {
                innerHtml += "<select id=‘sellookup" + index + "‘ style=\"width:100%;\font-family:Tahoma;font-size:11px\" onchange=\"selectLookUp_onchange_click(this,‘" + index + "‘)\">";
            }
            for (var i = 0; i < array.length; i++) {
                var selStr = "";
                if (array[i].split("/")[0] == selLookup) {
                    selStr = "selected=selected";
                }
                innerHtml += "<option " + selStr + " value = ‘" + array[i] + "‘>" + array[i] + "</option>";
            }
            innerHtml += "</select>";
        }
        else {
            innerHtml += "<span style=\"width:100%\">";
            innerHtml += array[0];
            innerHtml += "</span>";
        }
        return innerHtml;
    }

    //Table Onchange事件
    function selectTable_onchange_click(obj, rowIndex) {
        //返回TableName值给jasonMain
        datas.items[rowIndex].selTabName = obj.value;

        //找寻该表下的字段
        SelectFieldByTable(obj.value, rowIndex);
    }

    //Field Onchange事件
    function selectField_onchange_click(obj, rowIndex) {
        var fieldValue = obj.value.split("/")[0].toString();
        if (fieldValue == null) { return false; }
        //获取TableName
        var seltableObj = document.getElementById("selTab" + rowIndex);

        //返回Field值给jasonMain
        datas.items[rowIndex].SelFieldName = fieldValue;
        SelectLookUpOrPickList(seltableObj.value, obj.value, rowIndex);
    }

    //LookUp Onchange事件
    function selectLookUp_onchange_click(obj, rowIndex) {
                          //返回LookUp值给jasonMain
                          datas.items[rowIndex].selLookup = obj.value.split("/")[0];
                      }

</script>

<%--事件处理方法--%>
<script>
    var datas;
    //生成数据Table
    function SetDataSource(jsonObj, jsonGroup) {
        datas = {
            identifier: ‘id‘,
            label: ‘id‘,
            items: []
        };

        var i, len;
        for (i = 0, len = jsonObj.length; i < len; ++i) {
            datas.items.push(dojo.mixin({ ‘id‘: i + 1 }, jsonObj[i % len]));
        }

        var store = new dojo.data.ItemFileWriteStore({ data: datas });

        var gridList;
        gridList = new dojox.grid.DataGrid({
            id: ‘gridList‘,
            canSort: false,//禁用列头排序功能
            store: store,
            structure: gridCells
        });

        gridList.placeAt(‘grid‘);
        gridList.startup();

        SetDataSourceByGroup("Defined");
    }

    //判断字段是否已经被选择
    function IsSelectdByField(TableName, FiledName, rowIndex) {
        var arrays = new Array();
        var dataItems = datas.items;
        for (var i = 0; i < dataItems.length; i++) {
            if (dataItems[i].GroupName != "Defined") { continue; }
            if (dataItems[i].SelFieldName == null || dataItems[i].SelFieldName == undefined || dataItems[i].SelFieldName == "" || dataItems[i].SelFieldName == "undefined")
            { continue; }
            if (dataItems[i].selTabName == TableName && dataItems[i].SelFieldName == FiledName) {
                return true;
                break;
            }
        }
        return false;
    }

    //查找字段通过TableName
    function SelectFieldByTable(TableName, rowIndex) {
        var FieldStr = null;
        var flg = false;
        var xhrObj = {
            url: HRnet.Environment.webServerRoot + "/Modules/Payroll/PayrollHandler.ashx?action=SearchFiledByTableName",
            timeout: 50000,
            handleAs: "json",
            content: { "TableName": TableName },
            form: null,
            sync: true
        };
        //发起ajax请求
        var def = dojo.xhrPost(xhrObj);
        def.then(function (resp) {
            if (resp) {
                //操作响应数据
                flg = true;
                FieldStr = resp.FieldStr;
            }
        }, function (err) { alert(err); });

        //赋值
        datas.items[rowIndex].FieldName = FieldStr;

        if (FieldStr === null) { ClearDataAll(rowIndex); return; }

        //清除PickList和LookUp数据
        ClearData(rowIndex);

        // 重新生成子阶option
        addoptions("Table", "selField", rowIndex, FieldStr);
    }

    //清空PickList和LookUp
    function ClearData(rowIndex) {
        //清除PickList和LookUp数据
        var selLookUpObj = document.getElementById("sellookup" + rowIndex);
        selLookUpObj.options.length = 0;
    }

    //清空Field和PickList和LookUp
    function ClearDataAll(rowIndex) {
        //清除PickList和LookUp数据
        var selFieldObj = document.getElementById("selField" + rowIndex);
        selFieldObj.options.length = 0;
        datas.items[rowIndex].SelFieldName = "";

        //清除PickList和LookUp数据
        var selLookUpObj = document.getElementById("sellookup" + rowIndex);
        selLookUpObj.options.length = 0;
        datas.items[rowIndex].selLookup = "";
        document.getElementById("sellookup" + rowIndex).style.display = "none";
    }

    //获取PickList或者LookUP
    function SelectLookUpOrPickList(TableName, FiledName, rowIndex) {
        var FieldStr = "";
        var FieldType = "";
        var flg = false;
        var xhrObj = {
            url: HRnet.Environment.webServerRoot + "/Modules/Payroll/PayrollHandler.ashx?action=SearchFiledByFileName",
            timeout: 50000,
            handleAs: "json",
            content: { "FiledName": FiledName, "TableName": TableName },
            form: null,
            sync: true
        };
        //发起ajax请求
        var def = dojo.xhrPost(xhrObj);
        def.then(function (resp) {
            if (resp) {
                //操作响应数据
                flg = true;
                FieldStr = resp.FieldStr;
                FieldType = resp.jasonType;
            }
        }, function (err) { alert(err); });

        var selFieldObj = null;
        switch (FieldType) {
            case "8"://LookUp
                selFieldObj = "sellookup";
                document.getElementById(selFieldObj + rowIndex).style.display = "";
                break;
            default:
                document.getElementById("sellookup" + rowIndex).style.display = "none";
                return;
        }

        //赋值给选择的LookUp
        datas.items[rowIndex].LookUpField = FieldStr;

        //清除PickList和LookUp数据
        ClearData(rowIndex);

        if (selFieldObj == null) { return; }

        // 重新生成子阶option
        addoptions(FieldType, selFieldObj, rowIndex, FieldStr);
    }

    //添加Options
    function addoptions(type, parentId, rowIndex, subarray) {
        //获取父阶
        var selFieldObj = document.getElementById(parentId + rowIndex);
        //清除父阶
        selFieldObj.options.length = 0;
        //添加子阶
        var array = subarray.toString().split(",");
        for (var i = 0; i < array.length; i++) {
            selFieldObj.options.add(new Option(array[i], array[i]));
        }
        if (array != null) {
            switch (type) {
                case "Table":
                    datas.items[rowIndex].SelFieldName = array[0].toString().split("/")[0].toString();
                    break;
                case "8":
                    datas.items[rowIndex].selLookup = array[0].toString().split("/")[0].toString();
                    break;
                default:
            }
        }
    }

    //初始事件
    function initPage_Load() {
        var jsonMain = "";
        var jsonTable = "";
        var jsonGroup = "";
        var flg = false;
        var xhrObj = {
            url: HRnet.Environment.webServerRoot + "/Modules/Payroll/PayrollHandler.ashx?action=SearchDefineOutPutField",
            timeout: 50000,
            handleAs: "json",
            form: null,
            sync: true
        };
        //发起ajax请求
        var def = dojo.xhrPost(xhrObj);
        def.then(function (resp) {
            if (resp) {
                //操作响应数据
                flg = true;
                jsonMain = resp.jsonMain;
                jsonGroup = resp.jsonGroup;
                jsonTable = resp.jsonTable;
            }
        }, function (err) { alert(err); });

        //生成Group
        SetDataGroup(jsonGroup);
        //定义第一个列类别,默认显示
        var firstGroup = "";
        if (jsonGroup.length > 0)
            firstGroup = jsonGroup[0].GroupName;
        //生成数据Table
        SetDataSource(jsonMain, firstGroup);
    }

    revit.addOnLoad(_container_, function () {
        initPage_Load();
    });

    var arrayGroup;
    //选择Group类别,过滤数据
    function SetDataSourceByGroup(groupName) {
        var grid = dijit.byId("gridList");
        grid.focus.setFocusIndex(0, 1);
        grid.setQuery({ GroupName: "" + groupName + "" });
    }

    //单击Group类别,设置样式,过滤数据
    function GroupClick(obj, value) {
        if (value == "自定义") { value = "Defined"; }
        if (value == "标准") { value = "Standard"; }

        //if(value == "Standard"){SaveDataByGroupClick();}
        dojo.query("a").forEach(function (node, i) {
            node.style.backgroundColor = "";
            node.style.color = "";
        });;
        obj.style.backgroundColor = "#4aabbe";
        obj.style.color = "#fff";

        //数据过滤
        SetDataSourceByGroup(value);
    }

    //生成Group类别
    function SetDataGroup(jsonObj) {
        arrayGroup = new Array();
        var ulInnerHtml = "";
        var groupObj = document.getElementById("ulGroup");
        if (jsonObj != "") {
            var spanHtml = "";
            for (var i = 0; i < jsonObj.length; i++) {
                var groupName = jsonObj[i].GroupName;        //类别名称
                arrayGroup.push(groupName);
                if (i == 0) {
                    ulInnerHtml += "<li><a href=\"#\" style=\"background-color:#4aabbe;color:#fff\" onclick=\"GroupClick(this,‘" + groupName + "‘)\">" + groupName + "</a></li>";
                    spanHtml += "<span id=\"span" + groupName + "\" style=\"color:red;font-size:12px\" >" + groupName + "</span>";
                }
                else {
                    ulInnerHtml += "<li><a href=\"#\" onclick=\"GroupClick(this,‘" + groupName + "‘)\">" + groupName + "</a></li>";
                    spanHtml += "<span id=\"span" + groupName + "\" style=\"display:none;color:red;font-size:12px\">" + groupName + "</span>";
                }
            }
        }
        groupObj.innerHTML = ulInnerHtml;
    }

    //定义回传数据
    function ItemsToJsonString() {
        var arrays = new Array();
        var dataItems = datas.items;
        for (var i = 0; i < dataItems.length; i++) {
            if (dataItems[i].GroupName != "Defined") { continue; }
            //if (dataItems[i].SelFieldName == null || dataItems[i].SelFieldName == undefined || dataItems[i].SelFieldName == "" || dataItems[i].SelFieldName == "undefined")
            //{ continue; }
            var obj = new Object();
            obj.ZHPR_DEFINEDTABLE = dataItems[i].selTabName;
            obj.ZHPR_DEFINEDFILED = dataItems[i].SelFieldName;
            obj.ZHPR_MAPPINGOBJECT = "ZHPR_PRBATCHEMPLOYEEPROFILEDATA." + dataItems[i].PRBatchFieldName;
            obj.ZHPR_LOOKUPFILED = dataItems[i].selLookup;
            obj.ZHPR_PICKLISTFILED = "";//dataItems[i].selPicklist;
            arrays.push(obj);
        }
        return JSON.stringify(arrays);
    }

    //获取需要保存的数据个数
    function GetSaveCount() {
        var count = 0;
        var dataItems = datas.items;
        for (var i = 0; i < dataItems.length; i++) {
            if (dataItems[i].SelFieldName == null || dataItems[i].SelFieldName == undefined || dataItems[i].SelFieldName == "" || dataItems[i].SelFieldName == "undefined")
            { continue; }
            count++;
        }
        return count;
    }

    // 保存数据
    function SaveData() {
        //if (GetSaveCount() < 1) { alert("<%=RM.GetString("NotDataSave")%>"); return false; }
        var flg = "F";
        //定义ajax请求对象的属性
        var xhrObj = {
            url: HRnet.Environment.webServerRoot + "/Modules/Payroll/PayrollHandler.ashx?action=SaveDefinedField",
            timeout: 50000,
            handleAs: "json",
            content: { "dataJsonStr": ItemsToJsonString() },
            form: null,
            sync: true
        };
        //发起ajax请求
        var def = dojo.xhrPost(xhrObj);
        def.then(function (resp) {
            if (resp) {
                //操作响应数据
                flg = resp.Message; //alert(resp.number);
            }
        }, function (err) { alert(err); return false; });
        if (flg == "") { return false; }
        dijit.byId(‘setImportTemplateForm‘).clearMessages();
        if (flg == "T") {
            dijit.byId("setImportTemplateForm").addInfoMessage(‘<%=RM.GetString("SaveSucceedMsg")%>‘);
        }
        else {
            dijit.byId("setImportTemplateForm").addErrorMessage(‘<%=RM.GetString("SaveFailedMsg")%>‘);
        }
        setTimeout("dijit.byId(‘setImportTemplateForm‘).clearMessages();", 2000);
        return false;
    }

    function SaveDataByGroupClick() {
        var flg = "F";
        //定义ajax请求对象的属性
        var xhrObj = {
            url: HRnet.Environment.webServerRoot + "/Modules/Payroll/PayrollHandler.ashx?action=SaveDefinedField",
            timeout: 50000,
            handleAs: "json",
            content: { "dataJsonStr": ItemsToJsonString() },
            form: null,
            sync: true
        };
        //发起ajax请求
        var def = dojo.xhrPost(xhrObj);
        def.then(function (resp) {
            if (resp) {
                //操作响应数据
                flg = resp.Message; //alert(resp.number);
            }
        }, function (err) { alert(err); return false; });
        if (flg == "") { return false; }
        return false;
    }

    //返回
    function GoBack() {
        var url = HRnet.Environment.webServerRoot + "/Main.aspx/Home?dojo.preventCache=" + new Date();
        HRnet.Revolution.Form.DirtyPageCheck(
        function () {
            if (HRnet.Revolution.Form.RedirectToParentForm(false, false, true)) { return; }
            dijit.byId(HRnet.Revolution.Constants.Appcontainter).set("href", HRnet.Revolution.Form.CancelActionUrl, true);
        },
        url);
    }
</script>

<%--窗体结构--%>
<div id="setImportTemplateForm" onkeypress="keyPress" style="width:100%;" enctype="multipart/form-data" dojotype="revit.form.Form" method="post" canSort="false">
     <br />
    <input type="hidden"  id="hfMSTRID" />
     <div class="soria" style="width:98%;">
    <font size="1" >
		<div dojoType="dijit.layout.SplitContainer"
			 orientation="horizontal"
			 sizerWidth="7"
			 activeSizing="false"
			 style="border: 1px solid #bfbfbf; float: left; width: 100%; height: 600px;" canSort="false">

			 <div dojoType="dijit.layout.ContentPane" style="width:15%; background-color:#e5f1f1" id="prog_menu" >
                 <ul id="ulGroup">

                 </ul>
			 </div>		 

			 <div id="divContent" dojoType="dijit.layout.ContentPane" style="width:85%;border:2px;" sizeMin="40" sizeShare="50" canSort="false">
                 <table style="width:100%">
                     <tr>
                         <td>
                            <div id="grid" canSort="false">

                            </div>
                         </td>
                     </tr>
                </table>
			 </div>

		 </div>
      <button id="btnSave" dojotype="revit.form.Button" iconclass="save16" showlabel="true" onclick="return SaveData()"><%=RM.GetString("Save")%></button>
    </font>
</div>
</div>

  

时间: 2024-10-12 22:41:49

Dojo Grid结合Ajax用法的相关文章

jQuery中的ajax用法案例

什么是 AJAX? AJAX = 异步 JavaScript 和 XML(Asynchronous JavaScript and XML). 简短地说,在不重载整个网页的情况下,AJAX 通过后台加载数据,并在网页上进行显示. 使用 AJAX 的应用程序案例:谷歌地图.腾讯微博.优酷视频.人人网等等. 关于 jQuery 与 AJAX jQuery 提供多个与 AJAX 有关的方法. 通过 jQuery AJAX 方法,您能够使用 HTTP Get 和 HTTP Post 从远程服务器上请求文本

dojo grid 分页

dojo很强大,也很方便,但是缺少文档,只能看源代码,也挺好的,就是费时间... 网上找了一段代码(找不到原出处了,不好意思),也看了dojo自带的demo,放一段可以执行的页面代码这里.把ip换成自己架设的js服务器(esi的CDN貌似有点问题)即可 1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; ch

jQuery $.post $.ajax用法

jQuery $.post $.ajax用法 jQuery.post( url, [data], [callback], [type] ) :使用POST方式来进行异步请求 参数: url (String) : 发送请求的URL地址. data (Map) : (可选) 要发送给服务器的数据,以 Key/value 的键值对形式表示. callback (Function) : (可选) 载入成功时回调函数(只有当Response的返回状态是success才是调用该方法). type (Stri

dojo grid

关于dojo grid有几种,我们项目中只用了dojox.grid.EnhancedGrid.一个系统组件最好统一,不要乱用. EnhancedGrid提供一些常用的特性和一些基本的使用方法.我们下面都会讲到. 说到grid务必会需要store的数据支撑.EnhancedGrid常用的store有三种: dojox.data.QueryReadStore  //这个store主要是用于动态的load服务端的数据 dojo.data.ItemFileReadStore //顾名思义,FileRea

[ASP.NET]JQuery AJAX用法整理

摘要:[ASP.NET]JQuery AJAX用法整理 我们再用Jquery CallBack Server时有许多参数要如何使用 $.ajax({ type: "POST", url: "MyWebService.asmx/SayHelloJson", data: "{ firstName: 'Aidy', lastName: 'F' }", contentType: "application/json; charset=utf-8&

从零开始学_JavaScript_系列(九)——dojo(2)(AJAX、时间控件、鼠标事件、样式修改、事件移除、消息发布订阅)

(21)和(22)写的不好,跳过. (23)AJAX异步加载 插件:dojo/request 参数:request 语法(get): request.get(URL).then(成功回调函数,失败回调函数); 第一个回调函数是成功的,参数用response:(也可以用其他的) 第二个回调函数是失败的,参数用error:(也可以用其他的) 注: ①读取本地比较简单,直接填写本地的url即可: ②如果读取服务器端(比如数据库),那么需要相应的支持,例如python脚本等(我自己目前对python.和

Ajax用法与区别

上一次复习了XMLHttpRequest对象,这一次要总结一下Ajax的其他几个对象,以及各个版本的Ajax用法和区别. FormDate 现在Web中大家都会用到表单的数据序列化,XMLHttpRequest也提供了一个叫做FormData类型: var data=new FormData(); data.append("name","张三"); data.append("age","14"); alert(data.get

Ajax 用法

var total=100;                 var orderName='sssss';                 var orderDescrib='dddd';                 var pair2 = new NameValuePair("total", total);                 var pair3 = new NameValuePair("orderName", orderName);       

jQuery Ajax用法详解

[详解]jquery  ajax在web应用开发中常用,主要包括有ajax,get,post,load,getscript等这几种常用无刷新操作方法,下面来给大家介绍一下.我们首先先从最简单的方法看起. 我们先从最简单的方法看起,处理复杂的ajax请求时,jquery使用jquery.ajax()方法进行处理,在jquery中有一些简单的方法,他对jquery.ajax()方法进行了封装,是的我们在处理一些简单的ajax事件时,不需要使用jquery.ajax()方法,其中有些方法在之前的文章已