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;
})();
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;
})();
相关文章推荐
- jQuery获得内容和属性方法及示例
- 代码备忘-常用jquery脚本
- Asp.net Jquery Dialog 2
- jsp 登陆等待5s jquery
- jquery easyui无法绑定下拉框内容
- JQuery与struts的结合使用
- jquery tooltip.js
- jQuery.extend 函数详解
- jquery 插件 阅读
- 使用Jquery+EasyUI 进行框架项目开发案例讲解之五--模块(菜单)管理源码分享
- 使用Jquery+EasyUI 进行框架项目开发案例讲解之五--模块(菜单)管理源码分享 推荐
- 使用Jquery+EasyUI 进行框架项目开发案例讲解之五--模块(菜单)管理源码分享
- JQuery上传插件Uploadify详解及其中文按钮解决方案 .
- Jquery mobile 自定义 返回按钮 data-rel="back"
- Jquery实现自动提示下拉框
- jQuery获取表单域的值
- jquery表单提交验证
- javascript(phonegap+jquery monile)移动开发之(android)-----------搭建开发环境
- jQuery Sizzle选择器
- myeclipse9对导入的jquery.js文件报错——解决办法