$.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);
}
});
本文转自 hgditren 51CTO博客,原文链接:http://blog.51cto.com/phpme/1839960,如需转载请自行联系原作者