$.ajax({
url: "http://localhost:1005/api/values",
type: "GET",
beforeSend: function (xhr) {
xhr.setRequestHeader("X-Custom-Header1", "Bar");
},
success: function (data) {
alert(data);
},
error: function (xhr, textStatus, errorThrow) {
alert(xhr.readyState);
}
});
原文地址:http://phpme.blog.51cto.com/663593/1839960