From 5e770a4ef5e6030fc263a32e5c7d2827d81a486e Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Wed, 4 Jan 2023 16:47:03 -0600 Subject: [PATCH] updates making all forms work in production --- layouts/shortcodes/mt-church-form.html | 8 +++++++- layouts/shortcodes/mt-parent-form.html | 8 +++++++- layouts/shortcodes/mt-teacher-form.html | 8 +++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/layouts/shortcodes/mt-church-form.html b/layouts/shortcodes/mt-church-form.html index 4058981..34e190c 100644 --- a/layouts/shortcodes/mt-church-form.html +++ b/layouts/shortcodes/mt-church-form.html @@ -7,7 +7,13 @@ const data = new FormData(form); var xhr = new XMLHttpRequest(); - xhr.open("POST", "https://n8n.tfcconnection.org/webhook-test/mt-church-form"); + xhr.onreadystatechange = function() { + if (this.readyState == 4 && this.status == 200) { + // Logic directing where to send the user after form submission based on results. + window.location.href = '/thankyou/'; + }; + }; + xhr.open("POST", "https://n8n.tfcconnection.org/webhook/mt-church-form"); xhr.send(data); console.log(data); console.log("Hallo!"); diff --git a/layouts/shortcodes/mt-parent-form.html b/layouts/shortcodes/mt-parent-form.html index 79e3f7f..2a625b0 100644 --- a/layouts/shortcodes/mt-parent-form.html +++ b/layouts/shortcodes/mt-parent-form.html @@ -7,7 +7,13 @@ const data = new FormData(form); var xhr = new XMLHttpRequest(); - xhr.open("POST", "https://n8n.tfcconnection.org/webhook-test/mt-parent-form"); + xhr.onreadystatechange = function() { + if (this.readyState == 4 && this.status == 200) { + // Logic directing where to send the user after form submission based on results. + window.location.href = '/thankyou/'; + }; + }; + xhr.open("POST", "https://n8n.tfcconnection.org/webhook/mt-parent-form"); xhr.send(data); console.log(data); console.log("Hallo!"); diff --git a/layouts/shortcodes/mt-teacher-form.html b/layouts/shortcodes/mt-teacher-form.html index 3f0929e..a168dad 100644 --- a/layouts/shortcodes/mt-teacher-form.html +++ b/layouts/shortcodes/mt-teacher-form.html @@ -7,7 +7,13 @@ const data = new FormData(form); var xhr = new XMLHttpRequest(); - xhr.open("POST", "https://n8n.tfcconnection.org/webhook-test/mt-teacher-form"); + xhr.onreadystatechange = function() { + if (this.readyState == 4 && this.status == 200) { + // Logic directing where to send the user after form submission based on results. + window.location.href = '/thankyou/'; + }; + }; + xhr.open("POST", "https://n8n.tfcconnection.org/webhook/mt-teacher-form"); xhr.send(data); console.log(data); console.log("Hallo!");