Make ajax URL relative to webroot and variable name more unique

This commit is contained in:
Brain 2022-08-24 15:13:39 +02:00
parent 42b9b3a62e
commit f9229b5998
Signed by untrusted user: Brain
GPG Key ID: 9CF47083EE57670D

View File

@ -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,