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.
|
||
data-callback-complete |
Will be called after the ajax call, whatever if it failed or succeeded.
|
||
data-callback-success |
Will be called after the ajax call, only if it succeeded.
|
||
data-callback-failure |
Will be called after the ajax call, only if it failed.
|
||
data-callback-empty |
Will be called after the ajax call, only if the response is empty.
|
||
data-callback-not-empty |
Will be called after the ajax call, only if the response is not empty.
|