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!");