diff --git a/layouts/shortcodes/health-form.html b/layouts/shortcodes/health-form.html index dd20ed3..ee18f7d 100644 --- a/layouts/shortcodes/health-form.html +++ b/layouts/shortcodes/health-form.html @@ -67,27 +67,14 @@ data.forEach((value, key) => obj[key] = value); // For use in dev - /* fetch("http://localhost:4242/health-form", { - * method: "POST", - * body: data - * }).then((res) => { - * console.log(res); - * if (res.ok) { - * if (mtRegistration === 'now') - * window.location.href = 'https://secure.myvanco.com/L-Z772/campaign/C-13DM3'; - * else if (registration === 'now') - * window.location.href = 'https://secure.myvanco.com/L-Z772/campaign/C-13JPJ'; - * else if (registration === 'full') - * window.location.href = 'https://secure.myvanco.com/L-Z772/campaign/C-13JQE'; - * else - * window.location.href = '/thankyou/'; - * } - * }); */ - - // For use in prod - var xhr = new XMLHttpRequest(); - xhr.onreadystatechange = function() { - if (this.readyState == 4 && this.status == 200) { + // Can now start using this in production IF, + // I get the server running on the server + fetch("http://localhost:4242/health-form", { + method: "POST", + body: data + }).then((res) => { + console.log(res); + if (res.ok) { if (mtRegistration === 'now') window.location.href = 'https://secure.myvanco.com/L-Z772/campaign/C-13DM3'; else if (registration === 'now') @@ -97,10 +84,25 @@ else window.location.href = '/thankyou/'; } - }; - xhr.open("POST", "https://n8n.tfcconnection.org/webhook/health-form"); - xhr.send(data); - + }); + + // For use in prod + /* var xhr = new XMLHttpRequest(); + * xhr.onreadystatechange = function() { + * if (this.readyState == 4 && this.status == 200) { + * if (mtRegistration === 'now') + * window.location.href = 'https://secure.myvanco.com/L-Z772/campaign/C-13DM3'; + * else if (registration === 'now') + * window.location.href = 'https://secure.myvanco.com/L-Z772/campaign/C-13JPJ'; + * else if (registration === 'full') + * window.location.href = 'https://secure.myvanco.com/L-Z772/campaign/C-13JQE'; + * else + * window.location.href = '/thankyou/'; + * } + * }; + * xhr.open("POST", "https://n8n.tfcconnection.org/webhook/health-form"); + * xhr.send(data); + * */ console.log(data); /* window.location.replace("https://tfcconnection.org/thankyou/"); */ }