封装jQuery的ajax
来源:互联网 发布:淘宝网夏季竹凉席坐垫 编辑:程序博客网 时间:2024/05/18 03:58
学习代码,摘抄
function galasysJsonGet(url, json, callback, isAsync) { var isAsync = isAsync == undefined ? false : isAsync; if (url == '' || url == null || url == undefined) { return false; } else { if (typeof (json) == 'object') { json = JSON.stringify(json); } var ajaxRequest = $.ajax({ url: url, method: 'get', datatype: 'json', data: json, contentType: 'application/json;charset=utf-8', async: isAsync, cache: false }); ajaxRequest.done(function (msg) { if (callback != null) { callback(msg); } }); ajaxRequest.fail(function (jqXHR, textStatus) { alert("Request failed: " + textStatus); }); }}function galasysJsonPut(url, json, callback, isAsync) { //默认异步 var isAsync = isAsync == undefined ? true : isAsync; if (url == '' || url == null || url == undefined) { return false; } else { if (typeof (json) == 'object') { json = JSON.stringify(json); } //ajax请求 var ajaxRequest = $.ajax({ url: url, method: 'put', datatype: 'json', data: json, contentType: 'application/json;charset=utf-8', async: isAsync, cache: false }); ajaxRequest.done(function (msg) { if (callback != null) { callback(msg); } }); ajaxRequest.fail(function (jqXHR, textStatus) { alert("Request failed: " + textStatus); }); }}function galasysJsonPost(url, json, callback, isAsync) { //默认异步 var isAsync = isAsync == undefined ? false : isAsync; if (url == '' || url == null || url == undefined) { return false; } else { if (typeof (json) == 'object') { json = JSON.stringify(json); } //ajax请求 var ajaxRequest = $.ajax({ url: url, method: 'post', datatype: 'json', data: json, contentType: 'application/json;charset=utf-8', async: isAsync, cache: false }); ajaxRequest.done(function (msg) { if (callback != null) { callback(msg); } }); ajaxRequest.fail(function (jqXHR, textStatus) { alert("Request failed: " + textStatus); }); }}
阅读全文
0 0
- 封装jQuery的ajax
- jQuery封装的Ajax方法
- jQuery对AJAX的封装
- JQuery对Ajax的封装
- JQuery封装的ajax调用
- 基于jquery的ajax封装
- Jquery ajax的二次封装
- jQuery对Ajax的封装
- jQuery实现Ajax的封装
- jquery对Ajax的封装
- JQuery封装的ajax方法
- jQuery-jquery封装的ajax使用总结
- 对jquery的ajax的一个封装
- jquery封装的ajax的请求
- jquery的封装ajax的get请求
- 自己封装的jquery ajax函数
- 基于jquery.ajax的进一步封装
- 21、使用jQuery封装后的Ajax
- 今天我开通了博客
- CSS H5 定位
- MonkeyRunner—API篇之MonkeyImage&MonkeyRunner
- Android中thread.start()出现的thread already exist错误
- iOS多线程---GCD
- 封装jQuery的ajax
- java.sql.SQLException: Table 'XXX' is marked as crashed and should be repaired异常修复
- spark源码编译(maven)
- 二叉树的一个重要性质
- HTML中 点击图片翻转文字
- 不改变button大小,扩大点击范围
- webrtc开源代码阅读1 分享
- ES6 类的继承
- CentOS / RHEL v6.x: Install And Configure Serial Console