123456789101112131415161718192021222324252627282930313233343536 |
- /**
- * 给所有的ajax 添加监控 并处理
- *
- */
- jQuery(function($){
- // 备份jquery的ajax方法
- var _ajax=$.ajax;
- // 重写ajax方法,先判断登录在执行success函数
- $.ajax=function(opt){
- var _success = opt && opt.success || function(a, b){};
- var _opt = $.extend(opt, {
- success:function(data, textStatus){
- if(data.errorUrl) location.href=data.errorUrl;
- else
- _success(data, textStatus);
- }
- });
- _ajax(_opt);
- };
-
- $.ajax({
- url: baseConfig.URL.loginInfo + "",
- type: "get",
- data:{},
- cache: false,
- success:function (res) {
- console.log(res);
- },
- complete:function (XHR, TS) {
- // $('.ui-dialog-buttonpane').find('button:contains("保存添加信息")').removeAttr("disabled");
- },
- error:function (XMLHttpRequest, textStatus, errorThrown) {
- // alert(textStatus);
- }
- });
- });
|