The Request API for the TDI Ajax. Provides methods to send TDI requests.
Methods
-
<static> ajaxifyUrl(url)
-
Modifies the URL and adds an Ajax (tdi) flag.
Parameters:
Name Type Description url
String The URL to modify
Returns:
The modified URL
- Type
- String
-
<static> send(url, options)
-
Sends the Ajax request and calls the needed callback methods.
Parameters:
Name Type Description url
String The request URL.
options
Object jQuery.ajax() settings. Aditional options:
method <String>
The HTTP method used to send the request. Defaults to get.data <(String|Object)>
Data to be sent to the server. It is converted to a query string, if not already a string. See jQuery documentation for $.ajax()sync <(Boolean)>
Whether the AJAX request should be synchronous or not. Defaults to falsebeforeStart <Function>
Function to be called before the request is sent. If this function returns false, the request is not sent. This function is called with parameters:xhr <jqXHR>
the jqXHR objectsettings <Object>
The settings map used in the jQuery $.ajax calloptions <Object>
Aditional request options
start <Function>
Function to be called before the request is sent. This function is called with parameters:xhr <jqXHR>
The jqXHR objectsettings <Object>
The settings map used in the jQuery $.ajax calloptions <Object>
Aditional request options
beforeEnd <Function>
Function to be called after the request is complete. If this function returns false, the default end callback is not executed. This function is called with parameters:xhr <jqXHR>
The jqXHR objecttextStatus <String>
Status of the request ("success", "notmodified", "error", "timeout", "abort", or "parsererror")options <Object>
Aditional request options
end <Function>
Function to be called after the request is complete. This function is called with parameters:xhr <jqXHR>
The jqXHR objecttextStatus <String>
Status of the request ("success", "notmodified", "error", "timeout", "abort", or "parsererror")options <Object>
Aditional request options>
Returns:
xhr The jqXHR object
- Type
- jqXHR
-
<static> sendForm(form, options)
-
Submits a form using an Iframe (fake Ajax call).
Parameters:
Name Type Description form
String | jQuery | HTMLElement The form element which will be sent.
options
Object Aditional request options:
beforeStart <Function>
Function to be called before the request is sent. If this function returns false, the request is not sent. This function is called with parameters:form <jQuery>
The form which is to be submitedoptions <Object>
Aditional request options
start <Function>
Function to be called before the request is sent. This function is called with parameters:form <jQuery>
The form which is to be submitedoptions <Object>
Aditional request options
beforeEnd <Function>
Function to be called after the request is complete. If this function returns false, the default end callback is not executed. This function is called with parameters:form <jQuery>
The form which was submitedoptions <Object>
Aditional request optionsxml <jQuery>
The response XML document
end <Function>
Function to be called after the request is complete. This function is called with parameters:form <jQuery>
The form which was submitedoptions <Object>
Aditional request optionsxml <jQuery>
The response XML document
Returns:
xhr The jqXHR object or null if the iframe method is used
- Type
- jqXHR
Events
-
tdi:ajax:end
-
Fires when the TDI request has ended.
Parameters:
Name Type Description evt
Event The event object
data
Object The event properties
Properties:
Name Type Description options
Object Additional request options
-
tdi:ajax:error
-
Fires when the Ajax request ends with an error.
Parameters:
Name Type Description evt
Event The event object
data
Object The event properties
Properties:
Name Type Description status
String The XHR status text (if available)
message
String The error message
xhr
jqXHR The jqXHR object (see jQuery documentation for jQuery.ajax())
textStatus
String The XHR text status (if available)
options
Object Additional request options
-
tdi:ajax:start
-
Fires when the TDI request has started.
Parameters:
Name Type Description evt
Event The event object
data
Object The event properties
Properties:
Name Type Description xhr
jqXHR The jqXHR object
options
Object Additional request options
settings
Object The Ajax settings