making health form use the new server

This commit is contained in:
Chris Cochrun 2023-12-12 17:21:21 -06:00
parent e763c44aa9
commit a5b0d442d7

View file

@ -67,27 +67,14 @@
data.forEach((value, key) => obj[key] = value); data.forEach((value, key) => obj[key] = value);
// For use in dev // For use in dev
/* fetch("http://localhost:4242/health-form", { // Can now start using this in production IF,
* method: "POST", // I get the server running on the server
* body: data fetch("http://localhost:4242/health-form", {
* }).then((res) => { method: "POST",
* console.log(res); body: data
* if (res.ok) { }).then((res) => {
* if (mtRegistration === 'now') console.log(res);
* window.location.href = 'https://secure.myvanco.com/L-Z772/campaign/C-13DM3'; if (res.ok) {
* 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) {
if (mtRegistration === 'now') if (mtRegistration === 'now')
window.location.href = 'https://secure.myvanco.com/L-Z772/campaign/C-13DM3'; window.location.href = 'https://secure.myvanco.com/L-Z772/campaign/C-13DM3';
else if (registration === 'now') else if (registration === 'now')
@ -97,10 +84,25 @@
else else
window.location.href = '/thankyou/'; 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); console.log(data);
/* window.location.replace("https://tfcconnection.org/thankyou/"); */ /* window.location.replace("https://tfcconnection.org/thankyou/"); */
} }