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