METHOD:  HttpRequest::open

HttpRequest.open(Method, URL, Async, User, Password)

The open method initializes a Microsoft.XMLHTTP request, and specifies the method, URL and authentication information for the request. This method takes the following parameters:

  • Method
    This is a string specifying the method used to open the connection, such as GET, POST, PUT or PROPFIND.
  • Url
    This is a string of the requested URL. This can be either an absolute URL or a relative one.
  • Async
    This is a boolean value indicating whether the call is asynchronous. The default is true (the call returns immediately).
  • User
    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.
  • Password
    This is a password for authentication. If the value of the 'User' parameter is null or missing, this parameter is ignored.

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.

The following 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.

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



Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information