Reputation: 102
In this jQuery AJAX call we have a header
, what is the uses of this? Why should we use it?
$.ajax({
url: "/test",
headers: { "X-Test-Header": "test-value" }
});
Upvotes: 0
Views: 153
Reputation: 2613
It's a Request Header. HTTP header fields are components of the header section of request and response messages in the Hypertext Transfer Protocol (HTTP). They define the operating parameters of an HTTP transaction.
Request Header: The information, in the form of a text record, that a user's browser sends to a Web server containing the details of what the browser wants and will accept back from the server. The request header also contains the type, version and capabilities of the browser that is making the request so that server returns compatible data. Upon receipt of the request header, the server will return an HTTP response header to the client that is attached to the file(s) being sent.
Upvotes: 1