I am trying to pass request headers in an AJAX GET using jQuery. In the following block, "data" automatically passes the values in the querystring. Is there a way to pass that data in the request header instead ?
$.ajax({
url: "http://localhost/PlatformPortal/Buyers/Account/SignIn",
data: { signature: authHeader },
type: "GET",
success: function() { alert('Success!' + authHeader); }
});
The following didn't work either
$.ajax({
url: "http://localhost/PlatformPortal/Buyers/Account/SignIn",
beforeSend: { signature: authHeader },
async: false,
type: "GET",
success: function() { alert('Success!' + authHeader); }
});
Use
beforeSend
:http://api.jquery.com/jQuery.ajax/
http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader-method
As of jQuery 1.5, there is a
headers
hash you can pass in as follows:From http://api.jquery.com/jQuery.ajax: