fix leadform to avoid cors issue
deploy / build-and-publish (push) Successful in 40s

This commit is contained in:
Keith committed 2026-11-23 16:58:57 +01:00
1 parent 961e62a2e7
commit e31132cddc
1 file changed
+4 -5
+4 -5
View File
@@ -149,14 +149,13 @@ const note = type === "founders" ? strings.form_founders_note : strings.form_hub
button.disabled = true; button.disabled = true;
button.textContent = STRINGS.sending || "Sending…"; button.textContent = STRINGS.sending || "Sending…";
try { try {
const res = await fetch(form.dataset.webhook, { await fetch(form.dataset.webhook, {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, mode: "no-cors", // tell the browser we don't need to read the response
headers: { "Content-Type": "text/plain;charset=UTF-8" }, // no preflight triggered
body: JSON.stringify(payload), body: JSON.stringify(payload),
}); });
if (!res.ok) throw new Error("HTTP " + res.status); form.innerHTML = '<p class="lead-ok"></p>';
form.innerHTML =
'<p class="lead-ok"></p>';
form.querySelector(".lead-ok").textContent = form.dataset.i18nSuccess; form.querySelector(".lead-ok").textContent = form.dataset.i18nSuccess;
} catch { } catch {
const p = document.createElement("p"); const p = document.createElement("p");