Following code is giving me error while running npm run production. I have rechecked everything, and code is working fine, but not able to go through uglifyjs.
// Variables
let contactForm = $("#contact-form"),
formResponse = $(".form-response"),
submitButton = $("#submit");
contactForm.validator().on("submit", function(e) {
if(e.isDefaultPrevented()) {
formResponse.text("Sorry, you didn't fill the form.").fadeIn(1000);
} else {
e.preventDefault();
submitForm();
}
});
// Submit Function
function submitForm() {
// Some Variables
let name = $("#name").val(),
mail = $("#mail").val(),
message = $("#message").val();
$.ajax({
type: "POST",
url: "contact.php",
data: "name=" + name + "&mail=" + mail + "&message=" + message,
beforeSend: function(text) {
submitButton.html("<i class='fa fa-spinner fa-spin'></i> Sending...");
formResponse.fadeOut(500).text("");
},
success: function(text) {
if(text == "success") {
contactForm[0].reset();
formResponse.text("Thanks! Your message sent correctly.").fadeIn(1000);
submitButton.html("Send Message");
} else {
formResponse.text(text).fadeIn(1000);
}
}
});
}
via manshu
No comments:
Post a Comment