0
document.addEventListener('DOMContentLoaded', function() { let subform = document.getElementById('custom-sib-form'); subform.addEventListener('submit', function (event) { event.preventDefault(); var form = event.target; var formData = new FormData(form); fetch(form.action, { method: form.method, body: new URLSearchParams(formData).toString(), headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }) .then(data => { document.getElementById('form-response').style.display = 'block'; form.querySelector('button[type="submit"]').disabled = true; form.querySelector('button[type="submit"]').style.opacity = 0.8; document.getElementById('form-response').style.color = '#17ca17'; document.getElementById('form-response').innerText = "You have successfully subscribed to the newsletter"; }) .catch(error => { console.log(error) }); }); })