Interface ExtendedXMLHttpRequest

interface ExtendedXMLHttpRequest {
    DONE: 4;
    HEADERS_RECEIVED: 2;
    LOADING: 3;
    OPENED: 1;
    UNSENT: 0;
    onabort: ((this, ev) => any);
    onerror: ((this, ev) => any);
    onload: ((this, ev) => any);
    onloadend: ((this, ev) => any);
    onloadstart: ((this, ev) => any);
    onprogress: ((this, ev) => any);
    onreadystatechange: ((this, ev) => any);
    ontimeout: ((this, ev) => any);
    readyState: number;
    response: any;
    responseJSON: any;
    responseText: string;
    responseType: XMLHttpRequestResponseType;
    responseURL: string;
    responseXML: Document;
    status: number;
    statusText: string;
    timeout: number;
    upload: XMLHttpRequestUpload;
    withCredentials: boolean;
    abort(): void;
    addEventListener<K>(type, listener, options?): void;
    addEventListener(type, listener, options?): void;
    dispatchEvent(event): boolean;
    getAllResponseHeaders(): string;
    getResponseHeader(name): string;
    open(method, url): void;
    open(method, url, async, username?, password?): void;
    overrideMimeType(mime): void;
    removeEventListener<K>(type, listener, options?): void;
    removeEventListener(type, listener, options?): void;
    send(body?): void;
    setRequestHeader(name, value): void;
}

Hierarchy

  • XMLHttpRequest
    • ExtendedXMLHttpRequest

Properties

DONE: 4
HEADERS_RECEIVED: 2
LOADING: 3
OPENED: 1
UNSENT: 0
onabort: ((this, ev) => any)

Type declaration

    • (this, ev): any
    • Parameters

      • this: XMLHttpRequest
      • ev: ProgressEvent<EventTarget>

      Returns any

onerror: ((this, ev) => any)

Type declaration

    • (this, ev): any
    • Parameters

      • this: XMLHttpRequest
      • ev: ProgressEvent<EventTarget>

      Returns any

onload: ((this, ev) => any)

Type declaration

    • (this, ev): any
    • Parameters

      • this: XMLHttpRequest
      • ev: ProgressEvent<EventTarget>

      Returns any

onloadend: ((this, ev) => any)

Type declaration

    • (this, ev): any
    • Parameters

      • this: XMLHttpRequest
      • ev: ProgressEvent<EventTarget>

      Returns any

onloadstart: ((this, ev) => any)

Type declaration

    • (this, ev): any
    • Parameters

      • this: XMLHttpRequest
      • ev: ProgressEvent<EventTarget>

      Returns any

onprogress: ((this, ev) => any)

Type declaration

    • (this, ev): any
    • Parameters

      • this: XMLHttpRequest
      • ev: ProgressEvent<EventTarget>

      Returns any

onreadystatechange: ((this, ev) => any)

Type declaration

    • (this, ev): any
    • Parameters

      • this: XMLHttpRequest
      • ev: Event

      Returns any

ontimeout: ((this, ev) => any)

Type declaration

    • (this, ev): any
    • Parameters

      • this: XMLHttpRequest
      • ev: ProgressEvent<EventTarget>

      Returns any

readyState: number

Returns client's state.

MDN Reference

response: any

Returns the response body.

MDN Reference

responseJSON: any
responseText: string

Returns response as text.

Throws an "InvalidStateError" DOMException if responseType is not the empty string or "text".

MDN Reference

responseType: XMLHttpRequestResponseType

Returns the response type.

Can be set to change the response type. Values are: the empty string (default), "arraybuffer", "blob", "document", "json", and "text".

When set: setting to "document" is ignored if current global object is not a Window object.

When set: throws an "InvalidStateError" DOMException if state is loading or done.

When set: throws an "InvalidAccessError" DOMException if the synchronous flag is set and current global object is a Window object.

MDN Reference

responseURL: string
responseXML: Document

Returns the response as document.

Throws an "InvalidStateError" DOMException if responseType is not the empty string or "document".

MDN Reference

status: number
statusText: string
timeout: number

Can be set to a time in milliseconds. When set to a non-zero value will cause fetching to terminate after the given time has passed. When the time has passed, the request has not yet completed, and this's synchronous flag is unset, a timeout event will then be dispatched, or a "TimeoutError" DOMException will be thrown otherwise (for the send() method).

When set: throws an "InvalidAccessError" DOMException if the synchronous flag is set and current global object is a Window object.

MDN Reference

upload: XMLHttpRequestUpload

Returns the associated XMLHttpRequestUpload object. It can be used to gather transmission information when data is transferred to a server.

MDN Reference

withCredentials: boolean

True when credentials are to be included in a cross-origin request. False when they are to be excluded in a cross-origin request and when cookies are to be ignored in its response. Initially false.

When set: throws an "InvalidStateError" DOMException if state is not unsent or opened, or if the send() flag is set.

MDN Reference

Methods

  • Cancels any network activity.

    MDN Reference

    Returns void

  • Type Parameters

    • K extends keyof XMLHttpRequestEventMap

    Parameters

    • type: K
    • listener: ((this, ev) => any)
        • (this, ev): any
        • Parameters

          • this: XMLHttpRequest
          • ev: XMLHttpRequestEventMap[K]

          Returns any

    • Optional options: boolean | AddEventListenerOptions

    Returns void

  • Parameters

    • type: string
    • listener: EventListenerOrEventListenerObject
    • Optional options: boolean | AddEventListenerOptions

    Returns void

  • Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.

    MDN Reference

    Parameters

    • event: Event

    Returns boolean

  • Returns string

  • Parameters

    • name: string

    Returns string

  • Sets the request method, request URL, and synchronous flag.

    Throws a "SyntaxError" DOMException if either method is not a valid method or url cannot be parsed.

    Throws a "SecurityError" DOMException if method is a case-insensitive match for CONNECT, TRACE, or TRACK.

    Throws an "InvalidAccessError" DOMException if async is false, current global object is a Window object, and the timeout attribute is not zero or the responseType attribute is not the empty string.

    MDN Reference

    Parameters

    • method: string
    • url: string | URL

    Returns void

  • Parameters

    • method: string
    • url: string | URL
    • async: boolean
    • Optional username: string
    • Optional password: string

    Returns void

  • Acts as if the Content-Type header value for a response is mime. (It does not change the header.)

    Throws an "InvalidStateError" DOMException if state is loading or done.

    MDN Reference

    Parameters

    • mime: string

    Returns void

  • Type Parameters

    • K extends keyof XMLHttpRequestEventMap

    Parameters

    • type: K
    • listener: ((this, ev) => any)
        • (this, ev): any
        • Parameters

          • this: XMLHttpRequest
          • ev: XMLHttpRequestEventMap[K]

          Returns any

    • Optional options: boolean | EventListenerOptions

    Returns void

  • Parameters

    • type: string
    • listener: EventListenerOrEventListenerObject
    • Optional options: boolean | EventListenerOptions

    Returns void

  • Initiates the request. The body argument provides the request body, if any, and is ignored if the request method is GET or HEAD.

    Throws an "InvalidStateError" DOMException if either state is not opened or the send() flag is set.

    MDN Reference

    Parameters

    • Optional body: Document | XMLHttpRequestBodyInit

    Returns void

  • Combines a header in author request headers.

    Throws an "InvalidStateError" DOMException if either state is not opened or the send() flag is set.

    Throws a "SyntaxError" DOMException if name is not a header name or if value is not a header value.

    MDN Reference

    Parameters

    • name: string
    • value: string

    Returns void

Generated using TypeDoc