setRequestHeader
Summary
Sets the value of an XMLHttpRequest header.
Method of apis/xhr/XMLHttpRequestapis/xhr/XMLHttpRequest
Syntax
object.setRequestHeader(header, value);
Parameters
header
- Data-type
- String
Specifies the header name.
value
- Data-type
- String
Specifies the header value.
Return Value
No return value
Usage
If used, must be called after open(), but before send().
Notes
Refer to RFC2616, Section 14: Header Field Definitions for a general list of standard headers. The server is ultimately responsible for honoring the headers of the request. By far the most common request header is Content-Type, which is required by some XML Web services.
Related specifications
- W3C XMLHttpRequest Specification
- W3C Working Draft
Attributions
Microsoft Developer Network: Windows Internet Explorer API reference Article