XML DOM » HttpRequest » open

httpRequest.open(Method, URL, Async, User, Password)
This is a string specifying the method used to open the connection, such as GET, POST, PUT or PROPFIND.
This is a string of the requested URL. This can be either an absolute URL or a relative one.
This is a boolean value indicating whether the call is asynchronous. The default is true (the call returns immediately).
This is the name of the user for authentication purposes. If the value is null or missing, and the site requires authentication, a logon window will be displayed.
This is a password for authentication. If the value of the 'User' parameter is null or missing, this parameter is ignored.

This method initializes a Microsoft.XMLHTTP request, and specifies the method, URL and authentication information for the request.

The values of the request headers, request body, response headers and response body must be cleared before calling this method. If the 'Async' parameter is set to true, attach an onreadystatechange callback so you can tell when the send call has completed.


var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("POST", "http://guruserver/save.asp", false);

This example creates an HttpRequest object and uses the open method to synchronously open an ASP page. It then posts an XML document to that page, which in turn uses the loadXML method to load it.

Language(s): JavaScript