Ajax

Labels: :IA_Function:IA_Ajax
Inherits from: Function

Performs an HTTP request to an external url.

Parameters

Key Description Default value Possible values
url Target url to perform the HTTP request to. string (url)
method HTTP method GET GET/POST/PUT/DELETE/OPTIONS/CONNECT
data Payload or parameters to send with the request. object
headers Headers to send with the request. object
dataType Datatype expected back from the request. Intelligent guess
allowFailure If set to true, a failed request will not throw an error. true/false/1/0

Other parameters

This Function is a wrapper for the $.ajax jQuery function. Other than the parameters described above, the following parameters to the $.ajax function are supported (please refer to the jQuery documentation for their use):

  • accepts
  • cache
  • contents
  • contentType
  • converters
  • crossDomain
  • data
  • dataType
  • headers
  • ifModified
  • method
  • mimeType
  • password
  • processData
  • timeout
  • traditional
  • url
  • username
  • xhrFields

Outgoing triggers

Type: success

Fires when the request was successfully completed, and the response was received.

Additional event properties (besides the inherited properties):

Key Description Possible values
completed Indicates that the request was completed true
response The response to the request object
response.status The HTTP status of the request 200
response.statusText The HTTP status text of the request OK
response.data The response data object/string

Type: fail

Fires when the request was completed, but with errors.

Additional event properties (besides the inherited properties):

Key Description Possible values
completed Indicates that the request was completed true
response.status The HTTP status of the request HTTP status codes
response.statusText The HTTP status text of the request HTTP status texts
response.data The response data object/string
response.error The reported error message in the response (if any) string