fix(kontakt): replace simulated form submit with mailto: link
- Generate mailto: link with all form data on submit - Opens user's email client with pre-filled email to mki@kies-media.de - Subject includes interest type, body contains all form fields - Update success message to reflect email client behavior - Remove fake setTimeout simulation Fix #15
This commit is contained in:
@@ -71,14 +71,33 @@ $(function () {
|
||||
}
|
||||
});
|
||||
|
||||
// Form submit
|
||||
// Form submit – opens email client with pre-filled mailto: link
|
||||
$("#contactForm").on("submit", function (e) {
|
||||
e.preventDefault();
|
||||
var btn = $(this).find(".btn-submit");
|
||||
btn.text("Wird gesendet...").prop("disabled", true);
|
||||
setTimeout(function () {
|
||||
$("#contactForm").hide();
|
||||
$("#formSuccess").fadeIn(400);
|
||||
}, 1200);
|
||||
|
||||
var fname = $("#fname").val().trim();
|
||||
var lname = $("#lname").val().trim();
|
||||
var email = $("#email").val().trim();
|
||||
var phone = $("#phone").val().trim();
|
||||
var interest = $("#interest").val();
|
||||
var message = $("#message").val().trim();
|
||||
|
||||
var subject = "Kontaktanfrage: " + interest;
|
||||
var body = "Von: " + fname + " " + lname + "\n";
|
||||
body += "E-Mail: " + email + "\n";
|
||||
if (phone) body += "Telefon: " + phone + "\n";
|
||||
body += "Anliegen: " + interest + "\n\n";
|
||||
body += message;
|
||||
|
||||
var mailto =
|
||||
"mailto:mki@kies-media.de" +
|
||||
"?subject=" + encodeURIComponent(subject) +
|
||||
"&body=" + encodeURIComponent(body);
|
||||
|
||||
window.location.href = mailto;
|
||||
|
||||
// Show success message
|
||||
$("#contactForm").hide();
|
||||
$("#formSuccess").fadeIn(400);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user