一、setting参数 headers
$.ajax({
headers: {
Accept: "application/json; charset=utf-8"
},
type: "get",
success: function (data) {
}
});
二、beforeSend方法
-
$("#test").click(function() {
-
$.ajax({
-
type: "GET",
-
url: "default.aspx",
-
beforeSend: function(request) {
-
request.setRequestHeader("Test", "Chenxizhang");
-
},
-
success: function(result) {
-
alert(result);
-
}
-
});
-