Added: info
This commit is contained in:
@@ -53,4 +53,54 @@ async function copyCode(block, button) {
|
||||
setTimeout(() => {
|
||||
button.innerText = "copy";
|
||||
}, 700);
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const form = document.getElementById('cta-lead-form');
|
||||
const emailInput = document.getElementById('cta-email');
|
||||
const messageEl = document.getElementById('cta-message');
|
||||
const submitBtn = document.getElementById('cta-submit');
|
||||
|
||||
if (!form) {
|
||||
console.warn("Form not found");
|
||||
return;
|
||||
}
|
||||
|
||||
form.addEventListener('submit', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
const email = emailInput.value.trim();
|
||||
messageEl.textContent = '';
|
||||
|
||||
if (!email) {
|
||||
messageEl.textContent = 'Vul alstublieft uw e-mailadres in.';
|
||||
return;
|
||||
}
|
||||
|
||||
submitBtn.disabled = true;
|
||||
submitBtn.textContent = 'Versturen…';
|
||||
|
||||
fetch('https://crm.start-it.nl/api/v1/LeadCapture/f802fa2121e89066c15f1d31cf74fad0', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ emailAddress: email })
|
||||
})
|
||||
.then(function (res) {
|
||||
if (!res.ok) throw new Error("Niet-ok: " + res.status);
|
||||
|
||||
// Succes!
|
||||
emailInput.value = '';
|
||||
messageEl.textContent = 'U ontvangt een bericht zodra de website live is.';
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.error(err);
|
||||
messageEl.textContent = 'Er ging iets mis bij het versturen. Probeer het later opnieuw.';
|
||||
})
|
||||
.finally(function () {
|
||||
submitBtn.disabled = false;
|
||||
submitBtn.textContent = 'Verzonden';
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user