PageSourceSearch

https://msc.aliwc.pacypay.com/msc/js/ajax-util.js

js pacypay.com collected 2026-10-01 15:38:07 UTC 3,110 bytes, 99 lines download raw bytes

1// (function($) {
2//     // 首先备份下jquery的ajax方法
3//     var _ajax = $.ajax;
4//
5//     // 重写jquery的ajax方法
6//     $.ajax = function(options) {
7//         // 备份opt中error和success方法
8//         var callback = {
9//             "beforeSend" : function(XHR) {
10//             },
11//             "complete" : function(XHR, TS) {
12//             },
13//             "error" : function(XMLHttpRequest, textStatus, errorThrown) {
14//             },
15//             "success" : function(data, textStatus) {
16//             }
17//         }
18//
19//         // 判断参数中是否有beforeSend回调函数
20//         if (options.beforeSend) {
21//             callback.beforeSend = options.beforeSend;
22//         }
23//
24//         // 判断参数中是否有complete回调函数
25//         if (options.complete) {
26//             callback.complete = options.complete;
27//         }
28//
29//         // 判断参数中是否有error回调函数
30//         if (options.error) {
31//             callback.error = options.error;
32//         }
33//
34//         // 判断参数中是否有success回调函数
35//         if (options.success) {
36//             callback.success = options.success;
37//         }
38//
39//         // 扩展增强处理
40//         var _opt = $.extend(options, {
41//             error : function(XMLHttpRequest, textStatus, errorThrown) {
42//                 // 错误方法增强处理
43//                 callback.error(XMLHttpRequest, textStatus, errorThrown);
44//             },
45//             success : function(data,textStatus) {
46//                 // 成功回调方法增强处理
47//                 if(403==data.code){
48//                     parent.location.href = '/login';
49//                 }
50//                 callback.success(data);
51//             },
52//             beforeSend : function(XHR) {
53//                 // 提交前回调方法
54//                 var index = layer.load(1, {
55//                     shade: [0.1,'#fff'] //0.1透明度的白色背景
56//                 });
57//                 callback.beforeSend(XHR);
58//             },
59//             complete : function(XHR, TS) {
60//                 // 请求完成后回调函数 (请求成功或失败之后均调用)。
61//                 layer.closeAll('loading');
62//                 callback.complete(XHR, TS);
63//             }
64//         });
65//
66//         // 返回重写的ajax
67//         return _ajax(_opt);
68//     };
69// })(jQuery);
70//
71//
72//
73//
74
75
76//全站ajax加载提示
77(function ($) {
78    $(document).ajaxStart(function () {
79        var index = layer.load(1, {
80            shade: [0.1, '#fff'] //0.1透明度的白色背景
81        });
82    });
83    $(document).ajaxStop(function () {
84        layer.closeAll('loading');
85    });
86    //登录过期,shiro返回登录页面
87    $.ajaxSetup({
88        complete: function (xhr, status,dataType) {
89            if('text/html;charset=UTF-8'==xhr.getResponseHeader('Content-Type')){
90                top.location.href = '/login';
91            }
92        }
93    });
94})(jQuery);
95
96
97
98
99

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.