beforeSend方法
$("#btn").click(function() { $.ajax({ type: "GET", url: "/api/Product/id", beforeSend: function(request) { request.setRequestHeader("token","666"); }, success: function(result) { alert(result); } }); });
setting参数 headers
$.ajax({ headers: { Accept: "application/json; charset=utf-8" }, type: "get", success: function (data) { } });