document.addEventListener("DOMContentLoaded", function () {
const form = document.querySelector("form");
if (!form) {
return;
}
form.addEventListener("submit", function () {
setTimeout(function () {
const nom = document.querySelector('input[placeholder="Your name*"]')?.value || "";
const email = document.querySelector('input[placeholder="Mail*"]')?.value || "";
const telephone = document.querySelector('input[placeholder="Phone*"]')?.value || "";
const message = document.querySelector("textarea")?.value || "";
fetch("https://loginfo.ma/?wpwhpro_action=j&v=TA_CLE_API", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
name: nom,
email: email,
phone: telephone,
message: message
})
});
}, 500);
});
});