XMLHttpRequest.open()
Draft
This page is not complete.
The XMLHttpRequest.open() method initializes a request. This method is to be used from JavaScript code; to initialize a request from native code, use openRequest()
instead.
Note: Calling this method for an already active request (one for which
open()
or openRequest()
has already been called) is the equivalent of calling abort()
.JavaScript
Copy Code
void open( DOMString <var>method</var>, DOMString <var>url</var>, optional boolean <var>async</var>, optional DOMString <var>user</var>, optional DOMString <var>password</var> );
Parameters
method
- The HTTP method to use, such as "GET", "POST", "PUT", "DELETE", etc. Ignored for non-HTTP(S) URLs.
url
- The URL to send the request to.
async
- An optional boolean parameter, defaulting to
true
, indicating whether or not to perform the operation asynchronously. If this value isfalse
, thesend()
method does not return until the response is received. Iftrue
, notification of a completed transaction is provided using event listeners. This must be true if themultipart
attribute istrue
, or an exception will be thrown.Note: Starting with Gecko 30.0 (Firefox 30.0 / Thunderbird 30.0 / SeaMonkey 2.27), synchronous requests on the main thread have been deprecated due to the negative effects to the user experience. user
- The optional user name to use for authentication purposes; by default, this is an empty string.
password
- The optional password to use for authentication purposes; by default, this is an empty string.
-
Specifications
Specification Status Comment XMLHttpRequest
The definition of 'open()' in that specification.Living Standard WHATWG living standard Browser compatibility
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit) Basic support 1 (Yes) 5[1]
7(Yes) 1.2 Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile Basic support (Yes) 1.0 (Yes) (Yes) (Yes) (Yes) [1] This feature was implemented via ActiveXObject(). Internet Explorer implements the standard XMLHttpRequest since version 7.
See also
Using XMLHttpRequest
License
© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/xmlhttprequest/open