ajax封装 -- 更名为 Ajax
This commit is contained in:
parent
e42ee610e9
commit
817f36e73e
|
|
@ -33,7 +33,7 @@
|
||||||
var appindex = appLoading();
|
var appindex = appLoading();
|
||||||
var $form = $(this);
|
var $form = $(this);
|
||||||
|
|
||||||
var ajax = new $ax($form.attr("data-url"), function(data){
|
var ajax = new Ajax($form.attr("data-url"), function(data){
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
clearLoading(appindex);
|
clearLoading(appindex);
|
||||||
layer.msg(data.message, {shift: 1});
|
layer.msg(data.message, {shift: 1});
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@
|
||||||
icon: 3,
|
icon: 3,
|
||||||
btn: ['确定', '取消'] //按钮
|
btn: ['确定', '取消'] //按钮
|
||||||
}, function () {
|
}, function () {
|
||||||
var ajax = new $ax("${ctxPath}/cache/theme", function(data){
|
var ajax = new Ajax("${ctxPath}/cache/theme", function(data){
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
window.location.href="${ctxPath}/";
|
window.location.href="${ctxPath}/";
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@
|
||||||
onCheck: onCheck${id}_ipt
|
onCheck: onCheck${id}_ipt
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var treeList = new $ax("${ctxPath}/combotree/getTreeList", function(data){
|
var treeList = new Ajax("${ctxPath}/combotree/getTreeList", function(data){
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
$.fn.zTree.init($("#tree${id}_ipt"), setting, data.data);
|
$.fn.zTree.init($("#tree${id}_ipt"), setting, data.data);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -121,7 +121,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function initComboTreeName${id}_ipt(val) {
|
function initComboTreeName${id}_ipt(val) {
|
||||||
var treeName = new $ax("${ctxPath}/combotree/getTreeListName", function(data){
|
var treeName = new Ajax("${ctxPath}/combotree/getTreeListName", function(data){
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
$("#${id}_ipt").val(data.data);
|
$("#${id}_ipt").val(data.data);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@
|
||||||
var $form = $(this);
|
var $form = $(this);
|
||||||
var $imgcode=$("#"+$form.attr("data-imgcode"));
|
var $imgcode=$("#"+$form.attr("data-imgcode"));
|
||||||
|
|
||||||
var ajax = new $ax($form.attr("action"), function(data){
|
var ajax = new Ajax($form.attr("action"), function(data){
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
layer.msg(data.message, {shift: 1});
|
layer.msg(data.message, {shift: 1});
|
||||||
setTimeout(function(){window.location.href = "${ctxPath}/";}, 1200);
|
setTimeout(function(){window.location.href = "${ctxPath}/";}, 1200);
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@
|
||||||
beforeClick: zTreeBeforeClick
|
beforeClick: zTreeBeforeClick
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var ajax = new $ax("${ctxPath}/cache/deptTreeList", function(data){
|
var ajax = new Ajax("${ctxPath}/cache/deptTreeList", function(data){
|
||||||
if(data.code===0){
|
if(data.code===0){
|
||||||
$.fn.zTree.init($("#zTree"), setting, data.data);
|
$.fn.zTree.init($("#zTree"), setting, data.data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@
|
||||||
beforeClick: zTreeBeforeClick
|
beforeClick: zTreeBeforeClick
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var ajax = new $ax("${ctxPath}/cache/dicTreeList", function(data){
|
var ajax = new Ajax("${ctxPath}/cache/dicTreeList", function(data){
|
||||||
if(data.code===0){
|
if(data.code===0){
|
||||||
$.fn.zTree.init($("#zTree"), setting, data.data);
|
$.fn.zTree.init($("#zTree"), setting, data.data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var ajax = new $ax("${ctxPath}/cache/menuTreeList", function(data){
|
var ajax = new Ajax("${ctxPath}/cache/menuTreeList", function(data){
|
||||||
if(data.code === 0){
|
if(data.code === 0){
|
||||||
$.fn.zTree.init($("#zTree"), setting, data.data);
|
$.fn.zTree.init($("#zTree"), setting, data.data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var ajax = new $ax("${ctxPath}/cache/roleTreeList", function(data){
|
var ajax = new Ajax("${ctxPath}/cache/roleTreeList", function(data){
|
||||||
if(data.code === 0){
|
if(data.code === 0){
|
||||||
$.fn.zTree.init($("#zTree"), setting, data.data);
|
$.fn.zTree.init($("#zTree"), setting, data.data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var ajax = new $ax("${ctxPath}/user/userTreeList", function(data){
|
var ajax = new Ajax("${ctxPath}/user/userTreeList", function(data){
|
||||||
if(data.code === 0){
|
if(data.code === 0){
|
||||||
$.fn.zTree.init($("#zTree"), setting, data.data);
|
$.fn.zTree.init($("#zTree"), setting, data.data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
(function () {
|
(function () {
|
||||||
var $ax = function (url, success) {
|
var Ajax = function (url, success) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.type = "post";
|
this.type = "post";
|
||||||
this.data = {};
|
this.data = {};
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
this.success = success;
|
this.success = success;
|
||||||
};
|
};
|
||||||
|
|
||||||
$ax.prototype = {
|
Ajax.prototype = {
|
||||||
start : function () {
|
start : function () {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
|
|
@ -54,6 +54,6 @@
|
||||||
//closeDialog(data);
|
//closeDialog(data);
|
||||||
});
|
});
|
||||||
|
|
||||||
window.$ax = $ax;
|
window.Ajax = Ajax;
|
||||||
|
|
||||||
} ());
|
} ());
|
||||||
|
|
@ -482,7 +482,7 @@ var exwhere;
|
||||||
|
|
||||||
// 根据模块code生成每个工具条上面的 btn
|
// 根据模块code生成每个工具条上面的 btn
|
||||||
function initMenuBtn(obj, code) {
|
function initMenuBtn(obj, code) {
|
||||||
var ajax = new $ax(BladeApp.ctxPath + "/cache/getBtn", function (data) {
|
var ajax = new Ajax(BladeApp.ctxPath + "/cache/getBtn", function (data) {
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
toolbar = obj;
|
toolbar = obj;
|
||||||
btnjsons = data.data;
|
btnjsons = data.data;
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ $(function () {
|
||||||
var $form = $(this);
|
var $form = $(this);
|
||||||
var $imgcode=$("#"+$form.attr("data-imgcode"));
|
var $imgcode=$("#"+$form.attr("data-imgcode"));
|
||||||
|
|
||||||
var ajax = new $ax($form.attr("action"), function(data){
|
var ajax = new Ajax($form.attr("action"), function(data){
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
layer.msg(data.message, {shift: 1});
|
layer.msg(data.message, {shift: 1});
|
||||||
setTimeout(function(){window.location.href = BladeApp.ctxPath + "/";}, 1200);
|
setTimeout(function(){window.location.href = BladeApp.ctxPath + "/";}, 1200);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user