Pass request headers in a jQuery AJAX GET call
2021-01-04 23:29
标签:xhr localhost flow type ons keyword script att javascrip 回答1 As of jQuery 1.5, there is a From http://api.jquery.com/jQuery.ajax: 回答2 Use http://api.jquery.com/jQuery.ajax/ http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader-method Pass request headers in a jQuery AJAX GET call 标签:xhr localhost flow type ons keyword script att javascrip 原文地址:https://www.cnblogs.com/chucklu/p/14211414.htmlPass request headers in a jQuery AJAX GET call
headers
hash you can pass in as follows:$.ajax({
url: "/test",
headers: {"X-Test-Header": "test-value"}
});
beforeSend
:$.ajax({
url: "http://localhost/PlatformPortal/Buyers/Account/SignIn",
data: { signature: authHeader },
type: "GET",
beforeSend: function(xhr){xhr.setRequestHeader(‘X-Test-Header‘, ‘test-value‘);},
success: function() { alert(‘Success!‘ + authHeader); }
});
文章标题:Pass request headers in a jQuery AJAX GET call
文章链接:http://soscw.com/index.php/essay/40131.html