Esta tradução está incompleta. Por favor, ajude a traduzir este artigo.

XMLHttpRequest métodoopen() inicializa uma nova requisição, ou reinicializa uma requisição já existente.

Note: Chamar este método para uma requisição já ativada  (uma que open() já tenha sido chamada) é equivalente a chamar abort().

Syntax

XMLHttpRequest.open(method, url)
XMLHttpRequest.open(method, url, async)
XMLHttpRequest.open(method, url, async, user)
XMLHttpRequest.open(method, url, async, user, password)

Parameters

method
The HTTP request method to use, such as "GET", "POST", "PUT", "DELETE", etc. Ignored for non-HTTP(S) URLs.
url
A DOMString representing the URL to send the request to.
async Optional
Parâmetro booleano opcional, valor padrão true, indica quando realizar a operação de forma assíncrona. Se este valor for false, o método send() não retorna nada até que a resposta da requisição seja recebida. Se o valor for true, notification of a completed transaction is provided using event listeners. This must be true if the multipart attribute is true, or an exception will be thrown.
Note: Synchronous requests on the main thread can be easily disruptive to the user experience and should be avoided; in fact, many browsers have deprecated synchronous XHR support on the main thread entirely. Synchronous requests are permitted in Workers.
user Optional
The optional user name to use for authentication purposes; by default, this is the null value.
password Optional
The optional password to use for authentication purposes; by default, this is the null value.

Specifications

Specification Status Comment
XMLHttpRequest
The definition of 'open()' in that specification.
Padrão em tempo real WHATWG living standard

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support112 Yes1

7

52

Yes1.2
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support Yes1 Yes Yes1 Yes Yes Yes

1. Starting in Firefox 30, synchronous requests on the main thread have been deprecated due to their negative impact on performance and the user experience. Therefore, the async parameter may not be false except in a Worker.

2. Implemented via ActiveXObject

See also

Etiquetas do documento e colaboradores

Colaboradores desta página: mauromattos00
Última atualização por: mauromattos00,