Skip to content

Instantly share code, notes, and snippets.

@JustAyush
Created May 24, 2020 14:25
Show Gist options
  • Save JustAyush/e6aab86f0597aaad15ec3c6e4b68d06f to your computer and use it in GitHub Desktop.
Save JustAyush/e6aab86f0597aaad15ec3c6e4b68d06f to your computer and use it in GitHub Desktop.
success: function(response) {
// added portion starts here
let requredResponse = response.slice(response.length - 12);
// added portion ends here
if (requredResponse == "Message sent") { // change response to required response
$(".form-message").html(
"Your message has been submitted successfully"
);
$(".form-message").css("color", "lightgreen");
$(".form-message").css("opacity", "1");
$(".form-message").show();
$(".form-message")
.delay(5000)
.fadeTo(1000, 0);
$("#form").each(function() {
this.reset();
});
} else {
$(".form-message").html("Oops. Something went wrong.");
$(".form-message").css("color", "#ff9494");
$(".form-message").css("opacity", "1");
$(".form-message").show();
$(".form-message")
.delay(5000)
.fadeTo(1000, 0);
$("#form").each(function() {
this.reset();
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment