ajax添加header信息

$.ajax({
url:"xxx",
async:true,
dataType:"json",
contentType:"application/json",
data:{},
beforeSend: function (XMLHttpRequest) {XMLHttpRequest.setRequestHeader("Authorization", "bearer xxxxxxxxxx");}
success:function(result){}
});
http://www.w3school.com.cn/jquery/ajax_ajax.asp

猜你喜欢

转载自www.cnblogs.com/xsj1989/p/9768064.html