Documentation

XMLHttpRequest extends XMLHttpRequestEventTarget

XMLHttpRequest

Tags
link
https://www.w3.org/TR/XMLHttpRequest1/#the-xmlhttprequest-interface

Table of Contents

Constants

DONE  = 4
HEADERS_RECEIVED  = 2
LOADING  = 3
OPENED  = 1
UNSENT  = 0

Methods

abort()  : void
Cancels any network activity.
addEventListener()  : void
dispatchEvent()  : bool
getAllResponseHeaders()  : array<string|int, mixed>
Returns all headers from the response, with the exception of those whose field name is Set-Cookie or Set-Cookie2.
getResponseHeader()  : string
Returns the header field value from the response of which the field name matches header, unless the field name is Set-Cookie or Set-Cookie2.
open()  : void
Sets the request method, request URL, asynchronous flag, request username, and request password.
overrideMimeType()  : void
Acts as if the `Content-Type` header value for a response is mime.
removeEventListener()  : void
send()  : void
Initiates the request.
setRequestHeader()  : void
Appends an header to the list of author request headers or if the header is already in the author request headers its value appended to.

Constants

Methods

addEventListener()

public addEventListener(string $type, callable $listener[, bool $capture = false ]) : void
Parameters
$type : string
$listener : callable
$capture : bool = false

dispatchEvent()

public dispatchEvent(mixed $event) : bool
Parameters
$event : mixed
Return values
bool

getAllResponseHeaders()

Returns all headers from the response, with the exception of those whose field name is Set-Cookie or Set-Cookie2.

public getAllResponseHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>

getResponseHeader()

Returns the header field value from the response of which the field name matches header, unless the field name is Set-Cookie or Set-Cookie2.

public getResponseHeader(string $header) : string
Parameters
$header : string
Return values
string

open()

Sets the request method, request URL, asynchronous flag, request username, and request password.

public open(string $method, string $url[, bool $async = true ][, string $user = null ][, string $password = null ]) : void
Parameters
$method : string
$url : string
$async : bool = true
$user : string = null
$password : string = null

overrideMimeType()

Acts as if the `Content-Type` header value for a response is mime.

public overrideMimeType(string $mime) : void

(It does not change the header.)

Parameters
$mime : string

removeEventListener()

public removeEventListener(string $type, callable $listener[, bool $capture = false ]) : void
Parameters
$type : string
$listener : callable
$capture : bool = false

send()

Initiates the request.

public send([mixed $data = null ]) : void

The optional argument provides the request entity body. The argument is ignored if request method is GET or HEAD.

Parameters
$data : mixed = null

setRequestHeader()

Appends an header to the list of author request headers or if the header is already in the author request headers its value appended to.

public setRequestHeader(string $header, string $value) : void
Parameters
$header : string
$value : string

        
On this page

Search results