You can call different callbacks according to the following events. Your callbacks are called before processing the majority of other domajax options, and the domajax's normal behaviour can be cancelled by returing false in those callbacks. Callbacks will always receive elem (the element containing the ajax call) as first parameter, and jQuery's .ajax() standard response or errorThrown, textStatus and jqXHR callback arguments.

Event Description Test 1 Test 2
data-callback-before

Will be called before the ajax call, after data-confirm and before all other options.
Callback's prorotype: your_function(elem)

 
data-callback-complete

Will be called after the ajax call, whatever if it failed or succeeded.
Callback's prorotype: your_function(elem)

data-callback-success

Will be called after the ajax call, only if it succeeded.
Callback's prorotype: your_function(elem, response, textStatus, jqXHR)

data-callback-failure

Will be called after the ajax call, only if it failed.
Callback's prorotype: your_function(elem, errorThrown, textStatus, jqXHR)

data-callback-empty

Will be called after the ajax call, only if the response is empty.
Callback's prorotype: your_function(elem, response, textStatus, jqXHR)

data-callback-not-empty

Will be called after the ajax call, only if the response is not empty.
Callback's prorotype: your_function(elem, response, textStatus, jqXHR)

Back to domajax's home