16 lines
476 B
JavaScript
16 lines
476 B
JavaScript
|
|
// ajax 请求封装
|
||
|
|
function ajaxRequest(url, type, data, async, beforeFn, successFn, errorFn, contentType) {
|
||
|
|
$.ajax({
|
||
|
|
url: url,
|
||
|
|
type: type,
|
||
|
|
headers: {
|
||
|
|
"authorization": localStorage.getItem("zhgd_token")
|
||
|
|
},
|
||
|
|
data: data,
|
||
|
|
async: async,
|
||
|
|
beforeSend: beforeFn,
|
||
|
|
contentType: contentType || "application/x-www-form-urlencoded; charset=utf-8",
|
||
|
|
success: successFn,
|
||
|
|
error: errorFn
|
||
|
|
});
|
||
|
|
}
|