0
Absenden ich ein Pop-up-Formular für E-Mail-Abonnement hinzugefügt und es wird zweimal auf Vorlage senden und die Bestätigungsmeldung auch zweimalKontaktformular zweimal
Hier angezeigt wird, ist der Code:
$(document).ready(function() {
$(".modalbox").fancybox();
$("#contact").submit(function(e) {
e.preventDefault();
var emailval = $("#email").val();
var mailvalid = validateEmail(emailval);
if(mailvalid == false) {
$("#email").addClass("error");
}
else if(mailvalid == true){
$("#email").removeClass("error");
}
if(mailvalid == true) {
// if both validate we attempt to send the e-mail
// first we hide the submit btn so the user doesnt click twice
$("#send").replaceWith("<em>sending...</em>");
$.ajax({
type: 'POST',
url: 'sendmessage.php',
data: $("#contact").serialize(),
success: function(data) {
if(data == "true") {
$("#contact").fadeOut("fast", function(){
$(this).before("<p><strong>Success! You have signed up for a trial. A member of our team wil soon be in contact :)</strong></p>");
setTimeout("$.fancybox.close()", 1700);
});
}
}
});
}
});
});
Thank you very much! Es hat zuerst nicht funktioniert und ich sah mich früher online um und sah ein paar Leute setzen e.stopImmediatePropagation(); unter e.preventDefault(); und das hat für mich funktioniert. Nochmals vielen Dank :) – Ashton
Bitte achten Sie darauf, zu stimmen und die Antwort zu akzeptieren, wenn es Ihr Problem löst. :) –