XMLHttpRequest class

(XHR) objects are used to interact with servers. You can retrieve data from a URL without having to do a full page refresh. This enables a Web page to update just part of a page without disrupting what the user is doing. is used heavily in AJAX programming.

EventTarget

XMLHttpRequestEventTarget

XMLHttpRequest

Despite its name, can be used to retrieve any type of data, not just XML. If your communication needs to involve receiving event data or message data from a server, consider using server-sent events through the EventSource interface. For full-duplex communication, WebSockets may be a better choice. Note: This feature is available in Web Workers, except for Service Workers

Implemented types
Available extensions
Annotations
  • @JS()
  • @staticInterop

Constructors

XMLHttpRequest()
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
onabort EventHandlerNonNull<Event>?

Available on XMLHttpRequestEventTarget, provided by the PropsXMLHttpRequestEventTarget extension

getter/setter pair
onerror EventHandlerNonNull<Event>?

Available on XMLHttpRequestEventTarget, provided by the PropsXMLHttpRequestEventTarget extension

getter/setter pair
onload EventHandlerNonNull<Event>?

Available on XMLHttpRequestEventTarget, provided by the PropsXMLHttpRequestEventTarget extension

getter/setter pair
onloadend EventHandlerNonNull<Event>?

Available on XMLHttpRequestEventTarget, provided by the PropsXMLHttpRequestEventTarget extension

getter/setter pair
onloadstart EventHandlerNonNull<Event>?

Available on XMLHttpRequestEventTarget, provided by the PropsXMLHttpRequestEventTarget extension

getter/setter pair
onprogress EventHandlerNonNull<Event>?

Available on XMLHttpRequestEventTarget, provided by the PropsXMLHttpRequestEventTarget extension

getter/setter pair
onreadystatechange EventHandlerNonNull<Event>?

Available on XMLHttpRequest, provided by the PropsXMLHttpRequest extension

getter/setter pair
ontimeout EventHandlerNonNull<Event>?

Available on XMLHttpRequestEventTarget, provided by the PropsXMLHttpRequestEventTarget extension

getter/setter pair
readyState int

Available on XMLHttpRequest, provided by the PropsXMLHttpRequest extension

no setter
response → dynamic

Available on XMLHttpRequest, provided by the PropsXMLHttpRequest extension

no setter
responseText String

Available on XMLHttpRequest, provided by the PropsXMLHttpRequest extension

no setter
responseType XMLHttpRequestResponseType

Available on XMLHttpRequest, provided by the PropsXMLHttpRequest extension

getter/setter pair
responseURL String

Available on XMLHttpRequest, provided by the PropsXMLHttpRequest extension

no setter
responseXML Document?

Available on XMLHttpRequest, provided by the PropsXMLHttpRequest extension

no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
status int

Available on XMLHttpRequest, provided by the PropsXMLHttpRequest extension

no setter
statusText String

Available on XMLHttpRequest, provided by the PropsXMLHttpRequest extension

no setter
timeout int

Available on XMLHttpRequest, provided by the PropsXMLHttpRequest extension

getter/setter pair
upload XMLHttpRequestUpload

Available on XMLHttpRequest, provided by the PropsXMLHttpRequest extension

no setter
withCredentials bool

Available on XMLHttpRequest, provided by the PropsXMLHttpRequest extension

getter/setter pair

Methods

abort() → void

Available on XMLHttpRequest, provided by the PropsXMLHttpRequest extension

addEventListener(String type, EventListener? callback, [dynamic options]) → void

Available on EventTarget, provided by the PropsEventTarget extension

dispatchEvent(Event event) bool

Available on EventTarget, provided by the PropsEventTarget extension

getAllResponseHeaders() String

Available on XMLHttpRequest, provided by the PropsXMLHttpRequest extension

getResponseHeader(String name) String?

Available on XMLHttpRequest, provided by the PropsXMLHttpRequest extension

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
open(String method, [String? url, bool? async, String? username, String? password]) → void

Available on XMLHttpRequest, provided by the PropsXMLHttpRequest extension

overrideMimeType(String mime) → void

Available on XMLHttpRequest, provided by the PropsXMLHttpRequest extension

removeEventListener(String type, EventListener? callback, [dynamic options]) → void

Available on EventTarget, provided by the PropsEventTarget extension

send([dynamic body]) → void

Available on XMLHttpRequest, provided by the PropsXMLHttpRequest extension

setRequestHeader(String name, String value) → void

Available on XMLHttpRequest, provided by the PropsXMLHttpRequest extension

toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

done int
no setter
headersReceived int
no setter
loading int
no setter
opened int
no setter
unsent int
no setter