jquery 增加请求头

$.ajax({
	type: "POST",
	url: 'http://.......',
	dataType: "json",
	data: data,
	headers : {
		'X-Requested-With': 'XMLHttpRequest',
		'AAAAA': '11111',
		'BBBBB': '33333',
		'PPPPP': '66666'
	},
	success: function(res){
		alert(res);
	}
});

在这里插入图片描述
注意: 如果依旧是没有请求头,就将服务器端Access-Control-Allow-Headers设置为*
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_39816586/article/details/87624378
今日推荐