Ajax

Provides functionality to make asynchronous HTTP requests.

Properties

data String Object

Specifies the body data to be sent with the HTTP request.

httpRequest XMLHttpRequest

Specifies the body data to be sent with the HTTP request.

method String

Specifies the HTTP request method. For example, GET, POST

Default: GET

mode Boolean

Specifies whether the request sent is asynchronous or not.

Default: true

url String

Specifies the URL for the HTTP request.

Methods

getResponseHeader

Gets the response header for the given key.

Parameter Type Description
key String Specifies the response header key to return.

Returns: String Null

send

Sends the HTTTP request to the server.

Parameter Type Description
data (optional) String Object Specifies the response header key to return.

Returns: Promise<Ajax>

Events

beforeSend Function

Specifies a callback function that will be triggered before sending the HTTP request to server.

onFailure Function

Specifies a callback function that will be triggered when the HTTP request results in a failure.

onSuccess Function

Specifies a callback function that will be triggered when the HTTP request results in a success.