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

转载于:https://www.cnblogs.com/xsj1989/p/9768064.html

你可能感兴趣的:(ajax添加header信息)