您的位置:首页 > Web前端 > JQuery

jquery 封装的ajax调用

2013-12-02 18:00 447 查看
(function(){
var Ploy = {
Config: {
ajaxUrl: "/ajax/ploy.ashx"
},
ajax: function(params, callback) {
var that = this;
$.ajax({
type: "get",
cache: false,
dataType: "json",
url: that.Config.ajaxUrl,
data: params,
success: arguments[1] || function(){},
error: arguments[2] || function(){
if (window.console) {
console.log("error log: " + data.responseText);
}
}
});
},
GetBag: function(){
var that = this;
var params = {
ajaxMethod: "getbookbag",
random: Math.random()
};
var suc = function(data){
if(data.isSuccess === 1){
Common.ShowMessageGo(data.msg, location.href);
} else if(data.isSuccess === -1){
Common.login();
} else {
tar.disabled = false;
Common.ShowMessage(data.msg);
}
};
var err = function(){
};
that.ajax(params, suc, err);
}
};
window.Ploy = Ploy;
})();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: