mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-21 17:25:44 +03:00
Follow mockup for successful form submission
This commit is contained in:
parent
3133f0896a
commit
de07108905
4 changed files with 28 additions and 16 deletions
|
@ -93,15 +93,19 @@ jQuery( document ).ready( function( $ ) {
|
|||
},
|
||||
success( response ) {
|
||||
if ( response.message ) {
|
||||
const $message = $( '<div>' )
|
||||
.addClass( 'notice notice-alt' )
|
||||
.addClass( response.success ? 'notice-success' : 'notice-error' )
|
||||
.append( $( '<p>' ).html( response.message ) );
|
||||
|
||||
$( event.target.querySelector( '.message' ) ).html( $message );
|
||||
// Say the message for screen reader users.
|
||||
wp.a11y.speak( response.message );
|
||||
|
||||
if ( response.success ) {
|
||||
$( event.target.querySelector( 'input[type="submit"]' ) ).remove();
|
||||
closeModal();
|
||||
$( button ).after( $( '<p>' ).html( '<em>' + response.message + '<em>' ) );
|
||||
} else {
|
||||
const $message = $( '<div>' )
|
||||
.addClass( 'notice notice-alt' )
|
||||
.addClass( response.success ? 'notice-success' : 'notice-error' )
|
||||
.append( $( '<p>' ).html( response.message ) );
|
||||
|
||||
$( event.target.querySelector( '.message' ) ).html( $message );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue