Basic Ajax functionality for the TDI library. Used to bind DOM events to desired HTML elements and send the TDI request when the events fire.
Requires TDI global object.
Namespaces
Methods
- 
    <static> send(elm, callbacks)
- 
    
    Universal method for sending a TDI.Ajax call. It is called internaly for all Ajax enabled elements (like Links, Forms, Selects, Inputs). This method may be used in other scripts as TDI.Ajax.send( elm );where theelmparameter points to the element, which would trigger the Ajax call if it was Ajax enabled.- There are some HTML attributes of the element, which are used to configure the call:
- hrefThe target URL of the Ajax call
- actionThe same as href
- data-ajax-urlThe target URL of the Ajax call. Used if the Ajax URL should be different than the one defined by href or action attributes, or if the HTML element does not have URL attributes (select, input, ...)
- methodThe HTTP method to be used for the Ajax request. Only for Form elements. Forms with <input type="file"> elements will have forced POST method!
- data-ajax-methodThe HTTP method to be used for the Ajax request. The same as method but applicable for all elements. If used on Form element, it has precedence before method attribute (except Forms with file fields which have always POST method). Defaults to GET.
- data-related-elementA selector pointing to a related element. This element(s) gets notified when the Ajax call starts/ends.
- rel(deprecated; use data-related-element instead) The same as data-related-element
- data-related-ancestorA selector pointing to a related parent element. This element gets notified when the Ajax call starts/ends
- data-confirmA confirmation message. Use when the user should be able to stop the Ajax call
- disabledThe Ajax call does not start if the element has the disabled atribute set
- class="disabled"The Ajax call does not start if the element has a disabled class name
 Parameters:Name Type Description elmString | jQuery | HTMLElement The element which is used as a trigger for the Ajax call. callbacksObject An optional set of callbacks: - beforeStart <Function>If it returns false, the AJAX call and the default- startcallback will not be executed.
- start <Function>
- beforeEnd <Function>If it returns false, the default- endcallback will not be executed.
- end <Function>
 Returns:xhr The jqXHR object or null if the iframe method was used to send a form - Type
- jqXHR