jquery的参数里有headers,举例:
$.ajax({
type: "GET",
url:"?a=1",
dataType:"text/plain",
error: function(XHR,textStatus,errorThrown) {
alert ("XHR="+XHR+"\ntextStatus="+textStatus+"\nerrorThrown=" + errorThrown);
},
success: function(data,textStatus) {
alert(data);
},
headers: {
"header1":"aaaa",
'abc111':'ddkk11kd'
}
});
然后服务端就可以读取到自定义的header了