版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_33008701/article/details/55259570
jQuery.each(["get", "post"], function (i, method) { jQuery[method] = function (url, data, callback, type) { if (jQuery.isFunction(data)) { type = type || callback; callback = data; data = undefined; } return jQuery.ajax({ url: url, type: method, dataType: 'json', contentType: 'application/json', data: JSON.stringify(data), success: callback, beforeSend: function (xhr) { xhr.setRequestHeader("SignsValue", "签名-----------模拟"); xhr.setRequestHeader("TimeStamp", "时间戳---------模拟"); } }); }; });