Skip to main content

lwa_ajax_complete JS Hook

Triggered after an AJAX Auth form is submitted, the AJAX call was made, and any result is processed (success or error). This is trigged after any AJAX attempts are completed, whether success, error or any other status.

Parameters​

ParameterDescription
jqXHRPassed on by the complete function, jQuery jqXHR object, see the jQuery.ajax() settings.complete documenation for more information on this.
textStatusPassed on by the complete function, a string containing the result, such as success or error. See the jQuery.ajax() settings.complete documenation for more information on this.
formThe <form> that was submitted as a jQuery object.
statusElementThe status element as a jQuery object, used to display an error or confirmation message, by default is:

<span class="lwa-status" role="alert"></span>

Example​

The following example will trigger an alert popup if the result of the AJAX attempt was a timeout.

jQuery(document).on('lwa_ajax_complete', function( event, jqXHR, textStatus, form, statusElement ){
if( textStatus === 'timeout' ){
alert('Oops, the website is having some issues... try again shortly!');
}
});