var AjaxUrl = "service/Cityhandler.ashx"; $(document).ready(function () { $('#tab-container').easytabs(); GetCityZtree(); GetCity(); }); //擷取測試類型統計資料 function GetCity() { var begin = (new Date()).valueOf(); ;; $("#begin").html(begin); $.ajax({ type: "post", dataType: "json", traditional: true, data: { oper: "city" }, url: AjaxUrl, async: true,//表示同步執行 success: function (data, textStatus) { if (data != null) { $.fn.zTree.init($("#treeDemo"), setting, data); var end = (new Date()).valueOf(); ;; $("#end").html(end - begin); } }, complete: function (XMLHttpRequest, textStatus) { }, error: function (e) { alert("擷取測試類型統計資料失敗,請重新整理頁面重新載入!"); } }); } var setting = { async: { enable: true, url: AjaxUrl, autoParam: [ ["id"],["zid"] ], otherParam: { "oper":"city" } } }; function filter(treeId, parentNode, childNodes) { if (!childNodes) return null; for (var i = 0, l = childNodes.length; i < l; i++) { childNodes[i].name = childNodes[i].name.replace(/.n/g, '.'); } return childNodes; } //擷取測試類型統計資料 function GetCityZtree() { var begin = (new Date()).valueOf(); ;; $("#beginztree").html(begin); $.fn.zTree.init($("#treeDemoztree"), setting); var endztree = (new Date()).valueOf(); ;; $("#endztree").html(endztree-begin); } |