IntelligentRecognition/ah-jjsp-web/.svn/pristine/c9/c97e0dfff5542d264f3d05dac6d...

35 lines
865 B
Plaintext

// ajax 请求封装
function ajaxRequest(url, type, data, async, beforeFn, successFn, errorFn, contentType) {
$.ajax({
url: url,
type: type,
headers: {
"authorization": token
},
data: data,
async: async,
beforeSend: beforeFn,
contentType: contentType || "application/x-www-form-urlencoded; charset=utf-8",
success: successFn,
error: errorFn
});
}
// 文件上传
function ajaxRequest2(url, type, data, beforeFn, successFn, errorFn) {
$.ajax({
url: url,
type: type,
data: data,
headers: {
"authorization": token
},
async: true,
dataType: 'json',
processData: false,
contentType: false,
beforeSend: beforeFn,
success: successFn,
error: errorFn
});
}