On this Page

    http.setRequestHeader - define a custom request header

    Syntax

    http.setRequestHeader(header, value)

    Parameters

    http - is the variable name used in a prior call to new XMLHttpRequest;

    header - string containing name of the header to set.

    value - string value to set the header.

    Returned Value

    Zero if successful.

    Description

    Define a custom request header.

    Example

     var http = new XMLHttpRequest;
     http.open("POST", "http://www.docorigin.com/echo.php");
     http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
     var sData = "first=one&second=two";
     http.send(sData);
    
     var sResult = http.responseText;    // what was sent back
     _message("result='%s'", sResult);

    See Also

    XMLHttpRequest