jquery ajax call pass request headers code example
Example 1: pass header in ajax
$.ajax({
url: "/test",
headers: {"X-Test-Header": "test-value"}
});
Example 2: jquery get request with headers
$.ajax({
url: "http://localhost/myawsomecode/",
data: { param1: 'anyvalue', param2: 'othervalue' },
type: "GET",
beforeSend: function(xhr){xhr.setRequestHeader('X-Test-Header', 'SetHereYourValueForTheHeader');},
success: function() { alert('Success!'); }
});