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 urlString 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 urlString The request URL.
optionsObject 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 formString | jQuery | HTMLElement The form element which will be sent.
optionsObject 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 evtEvent The event object
dataObject The event properties
Properties:
Name Type Description optionsObject Additional request options
-
tdi:ajax:error
-
Fires when the Ajax request ends with an error.
Parameters:
Name Type Description evtEvent The event object
dataObject The event properties
Properties:
Name Type Description statusString The XHR status text (if available)
messageString The error message
xhrjqXHR The jqXHR object (see jQuery documentation for jQuery.ajax())
textStatusString The XHR text status (if available)
optionsObject Additional request options
-
tdi:ajax:start
-
Fires when the TDI request has started.
Parameters:
Name Type Description evtEvent The event object
dataObject The event properties
Properties:
Name Type Description xhrjqXHR The jqXHR object
optionsObject Additional request options
settingsObject The Ajax settings