jquery 封装的ajax调用
(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;
})();