const form = document.getElementById("contactForm"); const message = document.getElementById("responseMessage"); form.addEventListener("submit", function(e) { e.preventDefault(); const phone = document.getElementById("phone").value; const email = document.getElementById("email").value; fetch("https://script.google.com/macros/s/AKfycbymtX9pFnngPlk0vGQErZ291z1z73F2D3aEBHHrPzrh_E9e__Kg-sdAoJrjxTj_SRLgrg/exec", { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded", }, body: `phone=${encodeURIComponent(phone)}&email=${encodeURIComponent(email)}` }) .then(response => response.text()) .then(text => { if (text.includes("Duplicate")) { message.innerText = "This number has already been submitted."; } else { message.innerText = "Thanks! You'll be the first to get important updates and drops."; form.reset(); } }); });