//jquery版 发同步请求
function getData(url,param,fn){
var Authorization=localStorage.getItem("Authorization");
var commonParam={
"portalType": "PC_MID",
"reqTime": new Date().getTime(),
}
for(var key in commonParam){
param[key]=commonParam[key]
}
$.ajax({
type: 'post',
async: false,
timeout: 10000, // 超时时间 10 秒
headers: {
"Authorization":Authorization
},
dataType:'json',
contentType: 'application/json;charset=UTF-8',
url: url,
data: JSON.stringify(param),
success: function(data) {
fn(data)
},
error: function(err) {
},
complete: function(XMLHttpRequest, status) { //请求完成后最终执行参数
}
})
}