hmm
This commit is contained in:
+10
-2
@@ -117,15 +117,21 @@ function openModal(productHref) {
|
||||
}
|
||||
|
||||
function handleFormSubmit() {
|
||||
console.log("handelFormSubmit")
|
||||
const form = document.getElementById("buyForm");
|
||||
const confirmation = document.getElementById("confirmation");
|
||||
console.log("A")
|
||||
form.addEventListener("submit", async (e) => {i
|
||||
console.log("handler")
|
||||
|
||||
form.addEventListener("submit", async (e) => {
|
||||
e.preventDefault();
|
||||
const data = {};
|
||||
new FormData(form).forEach((value, key) => (data[key] = value));
|
||||
console.log("b")
|
||||
|
||||
try {
|
||||
console.log("c")
|
||||
|
||||
const res = await fetch(WEBHOOK_URL, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
@@ -133,9 +139,11 @@ function handleFormSubmit() {
|
||||
});
|
||||
|
||||
if (res.ok) {
|
||||
form.style.display = "none";
|
||||
console.log("ASS")
|
||||
|
||||
confirmation.style.display = "block";
|
||||
form.reset();
|
||||
document.getElementById("buyNowModal").style.display = "none";
|
||||
} else {
|
||||
alert("Failed to submit form.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user