From f9229b5998dcdd3bc09e9a0002c7df1146c87b20 Mon Sep 17 00:00:00 2001 From: Brain Date: Wed, 24 Aug 2022 15:13:39 +0200 Subject: [PATCH] Make ajax URL relative to webroot and variable name more unique --- assets/js/contact_form.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/js/contact_form.js b/assets/js/contact_form.js index 1d8bf65..758a934 100644 --- a/assets/js/contact_form.js +++ b/assets/js/contact_form.js @@ -1,4 +1,4 @@ -const ajaxUrl = '../php/contact_form.php'; +const contactFormAjaxUrl = '/php/contact_form.php'; const contact_form = document.getElementsByClassName('content__contact_form')[0]; const subject = document.getElementsByClassName('contact_form__subject')[0]; const message = document.getElementsByClassName('contact_form__message')[0]; @@ -11,7 +11,7 @@ const feedback = document.getElementsByClassName('contact_form__feedback')[0]; window.addEventListener('DOMContentLoaded', function(event) { let formData = new FormData(); formData.append('action', 'start_session'); - fetch(ajaxUrl, { + fetch(contactFormAjaxUrl, { method: 'POST', mode: 'same-origin', body: formData, @@ -39,7 +39,7 @@ contact_form.addEventListener('submit', function(event) { return; } - fetch(ajaxUrl, { + fetch(contactFormAjaxUrl, { method: 'POST', mode: 'same-origin', body: formData,