!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);