Open
Creates a new HTTP request and specifies the method, URL, and authentication information for this request
Syntax
Oxmlhttprequest.open (Bstrmethod, bstrURL, Varasync, Bstruser, bstrpassword);
Parameters
Bstrmethod
HTTP methods, such as POST, get, put, and propfind. Not sensitive to case.
bstrURL
The URL address of the request, which can be either an absolute address or a relative address.
varasync[Optional]
Boolean specifying whether this request is asynchronous and true by default. If true, the callback function specified by the onReadyStateChange property is invoked when the state changes.
bstruser[Optional]
If the server requires authentication, the user name is specified here, and if not specified, the validation window pops up when the server needs to authenticate.
bstrpassword[Optional]
The password portion of the authentication information, which is ignored if the user name is empty.
Example
The following example demonstrates requesting book.xml from a server and displaying the book field in it.
Java code var xmlhttp = new ActiveXObject ("msxml2.xmlhttp.3.0"); Xmlhttp.open ("Get", "http://localhost/books.xml", false); Xmlhttp.send (); var book = Xmlhttp.responseXML.selectSingleNode ("//book[@id = ' bk101 ']"); alert (book.xml);
Notes
After calling this method, you can call the Send method to send data to the server.