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

This commit is contained in:
Keith
2026-11-23 16:58:57 +01:00
parent 961e62a2e7
commit e31132cddc
+4 -5
View File
@@ -149,14 +149,13 @@ const note = type === "founders" ? strings.form_founders_note : strings.form_hub
button.disabled = true;
button.textContent = STRINGS.sending || "Sending…";
try {
const res = await fetch(form.dataset.webhook, {
await fetch(form.dataset.webhook, {
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),
});
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;
} catch {
const p = document.createElement("p");