Section 25.325. XMLHttpRequest.open( ): initialize HTTP request parameters


25.325. XMLHttpRequest.open( ): initialize HTTP request parameters

25.325.1. Synopsis

 void open(String method,           String url,           boolean async,           String username, String password) 

25.325.1.1. Arguments

method

The HTTP method to be used for the request. Reliably implemented values include GET, POST, and HEAD. Implementations may also support methods as well.


url

The URL that is the subject of the request. Most browsers impose a same-origin security policy (see Section 13.8.2) and require that this URL have the same hostname and port as the document that contains the script. Relative URLs are resolved in the normal way, using the URL of the document that contains the script.


async

Whether the request should be performed asynchronously or not. If this argument is false, the request is synchronous, and a subsequent call to send( ) will block until the response is fully received. If this argument is true or is omitted, the request is asynchronous, and an onreadystatechange event handler is typically required.


username, password

These optional arguments specify authorization credentials for use with URLs that require authorization. If specified, they override any credentials specified in the URL itself.

25.325.2. Description

This method initializes request parameters for later use by the send( ) method. It sets readyState to 1; deletes any previously specified request headers and previously received response headers; and sets the responseText, responseXML, status, and statusText properties to their default values. It is safe to call this method when readyState is 0 (when the XMLHttpRequest object is just created, or after a call to abort( )) and when readyState is 4 (after a response has been received). The behavior of open( ) is unspecified when it is called from any other state.

Other than storing request parameters for use by send( ) and resetting the XMLHttpRequest object for reuse, the open( ) method has no other behavior. In particular, note that implementations do not typically open a network connection to the web server when this method is called.

25.325.3. See Also

XMLHttpRequest.send( ); Chapter 20




JavaScript. The Definitive Guide
JavaScript: The Definitive Guide
ISBN: 0596101996
EAN: 2147483647
Year: 2004
Pages: 767

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net