lwa_action-name JS Hook

When a LWA form is submitted and a response is received. action-name will equate to login, remember or register

Parameters

response

The response object returned by AJAX call. You can also add the response.skip property to this object set to true and further action such as adding an error/success message to the top of the form will be skipped.

The response parameter will vary according to the action taken, see the PHP hooks lwa_ajax_login, lwa_ajax_remember or lwa_ajax_register for corresponding return values.

form The <form> that was submitted as a jQuery object.
statusElement The 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 change the backround color of the login form to red if login was unsuccesful and set the response.skip property to false so that no further action is taken by LWA.


				jQuery(document).on('lwa_login', function( event, response, form, statusElement ){
					if( !response.result ){
						response.skip = true;
						form.css('background-color', 'red');
						alert(response.error);
					}
				});