-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
display message in red for forms with message "Error"; also changed t…
…he colors of the submitted message
- Loading branch information
1 parent
2ded338
commit 143d2eb
Showing
1 changed file
with
7 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,17 +19,21 @@ function onSubmit(token) { | |
data: f.serialize(), | ||
beforeSend: function() { | ||
$( "#sfmc-form" ).toggle(); | ||
$( "#message" ).html( "Thank you for your submission. Your request is being processed..." ).addClass( "callout success" ); | ||
$( "#message" ).html( "Thank you for your submission. Your request is being processed..." ).addClass( "callout primary" ); | ||
message.scrollIntoView( { behavior: "smooth", block: 'center' } ); | ||
}, | ||
success: function(data) { | ||
var msg = $( data ).find( "p" ).text(); | ||
$( "#message" ).html( msg ); | ||
if ( msg.includes( "Error" ) ) { | ||
$( "#message" ).html( msg ).removeClass( "primary" ).addClass( "alert" ); | ||
} else { | ||
$( "#message" ).html( msg ).removeClass( "primary" ).addClass( "success" ); | ||
} | ||
message.scrollIntoView( { behavior: "smooth", block: 'center' } ); | ||
}, | ||
error: function(xhr, status, error) { | ||
var errorMessage = xhr.status + ': ' + xhr.statusText; | ||
$( "#message" ).html( "There was an error processing your submission. Please try again or contact us directly at [email protected].<br>(" + errorMessage + ")" ).removeClass( "success" ).addClass( "alert" ); | ||
$( "#message" ).html( "There was an error processing your submission. Please try again or contact us directly at [email protected].<br>(" + errorMessage + ")" ).removeClass( "primary" ).addClass( "alert" ); | ||
message.scrollIntoView( { behavior: "smooth", block: 'center' } ); | ||
} | ||
} | ||
|