From db2209b7d1cc8448abaa035174b8fb06827e3a8a Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Tue, 20 Dec 2022 15:06:00 -0600 Subject: [PATCH] fixing the redirect again --- layouts/shortcodes/health-form.html | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/layouts/shortcodes/health-form.html b/layouts/shortcodes/health-form.html index 5a517a0..47b17f5 100644 --- a/layouts/shortcodes/health-form.html +++ b/layouts/shortcodes/health-form.html @@ -52,16 +52,9 @@ } var xhr = new XMLHttpRequest(); - xhr.onreadystatechange = (e) => { - if (xhr.readyState !== 4) { - return; - } - - if (xhr.status === 200) { - console.log('SUCCESS', xhr.responseText); - window.location.href = "/thankyou/"; - } else { - console.warn('request_error', xhr.responseText); + xhr.onreadystatechange = function() { + if (this.readyState == 4 && this.status == 200) { + window.location.href = '/thankyou/'; } }; xhr.open("POST", "https://n8n.tfcconnection.org/webhook/health-form");