API Docs for: 1.7.7
Show:

TDI.Ajax.Response Class

Module: TDI

The Response API for the TDI AJAX. Provides a set of custom tdi events which can be used to control or to react to the TDI responses.

Methods

_end

() private

The default end callback.

_error

(
  • xhr
  • textStatus
  • error
  • options
)
private

The default error callback.

Parameters:

  • xhr JqXHR

    The jqXHR object

  • textStatus String

    The status of the response

  • error String

    The error message

  • options Object

    Additional request options

_onBeforeInsert

(
  • tag
  • options
)
private

The beforeInsert callback. It takes the <insert> xml node, gets its data and triggers a custom event which can stop the default insert action.

Parameters:

  • tag XMLNode

    The <insert> xml tag

  • options Object

    Additional request options

_onBeforePopup

(
  • tag
  • options
)
private

The beforePopup callback. It takes the <popup> xml node, gets its data and triggers a custom event which can stop the default popup action.

Parameters:

  • tag XMLNode

    The <popup> xml tag

  • options Object

    Additional request options

_onBeforeRedirect

(
  • tag
  • options
)
private

The before redirect callback. It takes the <redirect> xml node, gets its data and redirects the page to the given URL.

Parameters:

  • tag XMLNode

    The <redirect> xml tag

  • options Object

    Additional request options

_onBeforeReload

(
  • tag
  • options
)
private

The beforeReload callback. It just reloads the page.

Parameters:

  • tag XMLNode

    The <reload> xml tag

  • options Object

    Additional request options

_onBeforeScript

(
  • tag
  • options
)
private

The beforeScript callback. It takes the <script> xml node, gets its data and triggers a custom event which can stop the default script action.

Parameters:

  • tag XMLNode

    The <script> xml tag

  • options Object

    Additional request options

_onBeforeStyle

(
  • tag
  • options
)
private

The beforeStyle callback. It takes the <style> xml node, gets its data and triggers a custom event which can stop the default style action.

Parameters:

  • tag XMLNode

    The <style> xml tag

  • options Object

    Additional request options

_onBeforeUnknown

(
  • tag
  • options
)
private

The beforeUnknown callback. It takes an unknown instruction xml node, gets its data and triggers a custom event which can stop the default unknown action.

Parameters:

  • tag XMLNode

    The unknown instruction xml tag

  • options Object

    Additional request options

_onBeforeUpdate

(
  • tag
  • options
)
private

The beforeUpdate callback. It takes the <update> xml node, gets its data and triggers a custom event which can stop the default update action.

Parameters:

  • tag XMLNode

    The <update> xml tag

  • options Object

    Additional request options

_onInsertDefault

(
  • evt
  • data
)
private

The insert default response handler. Inserts the contents before/after the target.

Parameters:

  • evt Object

    The event object

  • data Object

    The insert data object:

    target_id <String> The ID of the target element
    target <jQuery> The target element
    content <String> The new HTML contents
    position <String> ("before"|"after") Whether to insert the contents before, or after the target
    options <Object> Additional request options

_onPopupDefault

(
  • evt
  • data
)
private

The popup default response handler.

Parameters:

  • evt Object

    The event object

  • data Object

    The popup data object:

    href <String> Target URL of the popup
    mode <String> ("popup"|"dialog") The type of the popup
    width <Integer> Width of the popup in mode "dialog"
    height <Integer> Height of the popup in mode "dialog"
    options <Object> Additional request options

_onRedirectDefault

(
  • evt
  • data
)
private

The redirect default response handler. Redirects the page to a given URL.

Parameters:

  • evt Object

    The event object

  • data Object

    The redirect data object:

    href <String> URL of the redirect
    options <Object> Additional request options

_onReloadDefault

(
  • data
)
private

The reload default response handler. Reloads the page.

Parameters:

  • data Object

    The reload data object

    options <Object> Additional request options

_onScriptDefault

(
  • evt
  • data
)
private

The script default response handler. Loads and executes new scripts.

Parameters:

  • evt Object

    The event object

  • data Object

    The script data object:

    script_src <String> URL of the new external script
    script_data <String> Inline script data
    script_id <String> ID of the <script> tag
    options <Object> Additional request options

_onStyleDefault

(
  • evt
  • data
)
private

The style default response handler. Loads external stylesheets.

Parameters:

  • evt Object

    The event object

  • data Object

    The style data object:

    style_src <String> URL of the new external stylesheet
    style_id <String> ID of the <link> tag
    options <Object> Additional request options

_onUnknownDefault

(
  • evt
  • data
)
private

The unknown instruction default response handler.

Parameters:

  • evt Object

    The event object

  • data Object

    The dialog data object:

    contents <String> Instruction contents
    options <Object> Additional request options

_onUpdateDefault

(
  • evt
  • data
)
private

The update default response handler. Updates the specified target with new contents.

Parameters:

  • evt Object

    The event object

  • data Object

    The update data object:

    target_id <String> The ID of the target element
    selector <String> CSS selector for multiple targets
    target <jQuery> The target element
    content <String> The new HTML contents
    replace <String> ("true"|"false") Whether to update the targets contents, or to replace the whole target
    append <String> ("true"|"false") Whether to append the new contents at the end of the target
    prepend <String> ("true"|"false") Whether to prepend the new contents at the begining of the target
    class_add <String> CSS class name(s) which will be added to the target. Multiple class names are separated by a space
    class_remove <String> CSS class name(s) which will be added to the target. Multiple class names are separated by a space
    options <Object> Additional request options

_start

(
  • xhr
  • settings
  • options
)
private

The default start callback.

Parameters:

  • xhr JqXHR

    The jqXHR object

  • settings Object

    The Ajax settings

  • options Object

    Additional request options

_success

(
  • xml
  • textStatus
  • xhr
  • options
)
private

The default success callback.

Parameters:

  • xml JQuery

    The response XML document

  • textStatus String

    The status of the response

  • xhr JqXHR

    The jqXHR object

  • options Object

    Additional request options

Events

tdi:ajax:beforeInsert

Fires before the TDI insert takes place.

This event is preventable. Use preventDefault() to prevent the default action (Response._onInsertDefault).

Event Payload:

  • evt Event

    The event object

  • data Object

    The event data:

    target_id <String> The ID of the update target
    target <jQuery> The update target
    content <String> The contents
    position <String> The position of the insert (before|after)

tdi:ajax:beforePopup

Fires before the TDI popup takes place.

This event is preventable. Use preventDefault() to prevent the default action (Response._onPopupDefault).

Event Payload:

  • evt Event

    The event object

  • data Object

    The event data:

    href <String> The URL of the popup
    mode <String> The mode of the popup (popup|dialog)
    width <Integer> Width of the popup. Available only for dialog mode
    height <Integer> Height of the popup. Available only for dialog mode

tdi:ajax:beforeRedirect

Fires before the TDI redirect takes place.

This event is preventable. Use preventDefault() to prevent the default action (Response._onRedirectDefault).

Event Payload:

  • evt Event

    The event object

  • data Object

    The event data:

    href <String> The URL to redirect to

tdi:ajax:beforeReload

Fires before the TDI reload takes place.

This event is preventable. Use preventDefault() to prevent the default action (Response._onReloadDefault).

Event Payload:

  • evt Event

    The event object

tdi:ajax:beforeScript

Fires before the TDI script takes place.

This event is preventable. Use preventDefault() to prevent the default action (Response._onScriptDefault).

Event Payload:

  • evt Event

    The event object

  • data Object

    The event data:

    script_src <String> Path to the external Javascript file
    script_data <String> Inline Javascript code
    script_id <String> ID of the <script> tag

tdi:ajax:beforeStyle

Fires before the TDI style takes place.

This event is preventable. Use preventDefault() to prevent the default action (Response._onStyleDefault).

Event Payload:

  • evt Event

    The event object

  • data Object

    The event data:

    style_src <String> Path to the external CSS file
    style_id <String> ID of the <link> tag

tdi:ajax:beforeUnknown

Fires before the TDI instruction takes place.

This event is preventable. Use preventDefault() to prevent the default action (Response._onUnknownDefault).

Event Payload:

  • evt Event

    The event object

  • data Object

    The event data:

    contents <String> Instruction contents
    ATTRS_NAME <String> Other attributes

tdi:ajax:beforeUpdate

Fires before the TDI update takes place.

This event is preventable. Use preventDefault() to prevent the default action (Response._onUpdateDefault).

Event Payload:

  • evt Event

    The event object

  • data Object

    The event data:

    target_id <String> The ID of the update target
    selector <String> CSS selector for multiple targets
    target <jQuery> The update target
    content <String> The update contents
    content_empty <Boolean> Indicates whether the contents are empty
    replace <String> Indicates whether the contents will replace the whole target
    append <String> Indicates whether the contents will be appended to the end of the target
    prepend <String> Indicates whether the contents will be prepended to the beginning of the target
    class_add <String> Space separated list of class names to add
    class_remove <String> Space separates list of class names to remove

tdi:ajax:done

Fires when all TDI actions are done.

Event Payload:

  • evt Event

    The event object

  • data Object

    The event data:

    responses <Array> The list of all TDI actions
    options <Array> Additional request options

tdi:ajax:end

Fires when the TDI request has ended.

Event Payload:

  • evt Event

    The event object

  • data Object

    The event data:

    options <Array> Additional request options

tdi:ajax:error

Fires when the Ajax request ends with an error.

Event Payload:

  • evt Event

    The event object

  • data Object

    The event data:

    status <Array> The XHR status text (if available)
    message <Array> The error message
    xhr <jqXHR> The jqXHR object (see jQuery documentation for jQuery.ajax())
    textStatus <String> The XHR text status (if available)
    options <Array> Additional request options

tdi:ajax:insert

Fires after the TDI insert takes place.

Event Payload:

  • evt Event

    The event object

  • data Object

    The event data:

    target_id <String> The ID of the update target
    target <jQuery> The update target
    content <String> The contents
    position <String> The position of the insert (before|after)
    inserted_node <jQuery> Reference to the inserted HTML node
    options <Object> Additional request options

tdi:ajax:insertsDone

Fires when all TDI <insert>s are done.

Event Payload:

  • evt Event

    The event object

  • data Object

    The event data:

    inserts <Array> The list of all inserts
    options <Array> Additional request options

tdi:ajax:popup

Fires after the TDI popup takes place.

Event Payload:

  • evt Event

    The event object

  • data Object

    The event data:

    href <String> The URL of the popup
    mode <String> The mode of the popup (popup|dialog)
    width <Integer> Width of the popup. Available only for dialog mode
    height <Integer> Height of the popup. Available only for dialog mode
    popup <window> Reference to the opened window
    options <Object> Additional request options

tdi:ajax:popupsDone

Fires when all TDI <popup>s are done.

Event Payload:

  • evt Event

    The event object

  • data Object

    The event data:

    popups <Array> The list of all popups
    options <Array> Additional request options

tdi:ajax:script

Fires after the TDI script takes place.

Event Payload:

  • evt Event

    The event object

  • data Object

    The event data:

    script_src <String> Path to the external Javascript file
    script_data <String> Inline Javascript code
    script_id <String> ID of the <script> tag
    script_node <jQuery> Reference to the inserted <script> node
    options <Object> Additional request options

tdi:ajax:scriptsDone

Fires when all TDI <script>s are done.

Event Payload:

  • evt Event

    The event object

  • data Object

    The event data:

    scripts <Array> The list of all scripts
    options <Array> Additional request options

tdi:ajax:start

Fires when the TDI request has started.

Event Payload:

  • evt Event

    The event object

  • data Object

    The event data:

    xhr <jqXHR> The jqXHR object
    options <Array> Additional request options
    settings <Array> The Ajax settings

tdi:ajax:style

Fires after the TDI style takes place.

Event Payload:

  • evt Event

    The event object

  • data Object

    The event data:

    style_src <String> Path to the external CSS file
    style_id <String> ID of the <link> tag
    style_node <jQuery> Reference to the inserted <link> node
    options <Object> Additional request options

tdi:ajax:stylesDone

Fires when all TDI <style>s are done.

Event Payload:

  • evt Event

    The event object

  • data Object

    The event data:

    styles <Array> The list of all styles
    options <Array> Additional request options

tdi:ajax:unknown

Fires after the TDI unknown instruction takes place.

Event Payload:

  • evt Event

    The event object

  • data Object

    The event data:

    contents <String> Instruction contents
    ATTRS_NAME <String> Other attributes

tdi:ajax:unknownsDone

Fires when all <unknown> TDI instructions are done.

Event Payload:

  • evt Event

    The event object

  • data Object

    The event data:

    instructions <Array> The list of all unknown instructions
    options <Array> Additional request options

tdi:ajax:update

Fires after the TDI update takes place.

Event Payload:

  • evt Event

    The event object

  • data Object

    The event data:

    target_id <String> The ID of the update target
    target <jQuery> The update target
    content <String> The update contents
    content_empty <Boolean> Indicates whether the contents are empty
    replace <String> Indicates whether the contents will replace the whole target
    append <String> Indicates whether the contents will be appended to the end of the target
    prepend <String> Indicates whether the contents will be prepended to the beginning of the target
    class_add <String> Space separated list of class names to add
    class_remove <String> Space separates list of class names to remove
    options <Object> Additional request options

tdi:ajax:updatesDone

Fires when all TDI <update>s are done.

Event Payload:

  • evt Event

    The event object

  • data Object

    The event data:

    updates <Array> The list of all updates
    options <Array> Additional request options