| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
 | | !function (n) { |  |     "use strict"; |  |   |  |     const http = { |  |         toAjax: function (params) { |  |             $.ajax(params); |  |         }, |  |         get: function (url, data, callback) { |  |             http.toAjax({ |  |                 method: 'GET', |  |                 url: url, |  |                 data: data, |  |                 dataType: 'json', |  |                 header: {'Content-Type': 'application/json'}, |  |                 timeout: 10000, |  |                 cache: false, |  |                 success: function (result) { |  |                     callback(result); |  |                 }, |  |                 error: function (res, type) { |  |   |  |                 } |  |             }) |  |         }, |  |         post: function (url, data, callback, type) { |  |             let headerType; |  |             if (type === 'form') { |  |                 headerType = {'Content-Type': 'application/x-www-form-urlencoded'} |  |             } else { |  |                 headerType = {'Content-Type': 'application/json'} |  |             } |  |             http.toAjax({ |  |                 method: 'POST', |  |                 url: url, |  |                 data: data, |  |                 dataType: 'json', |  |                 header: headerType, |  |                 timeout: 10000, |  |                 cache: false, |  |                 success: function (result) { |  |                     callback(result); |  |                 }, |  |                 error: function (res, type) { |  |   |  |                 } |  |             }) |  |         }, |  |     }; |  |   |  |   |  |     "function" == typeof define && define.amd ? define(function () { |  |         return http |  |     }) : "object" == typeof module && module.exports ? module.exports = http : n.http = http |  | }(this); | 
 |