forked from ag_kommunikation/webseite
Make ajax URL relative to webroot and variable name more unique
This commit is contained in:
parent
42b9b3a62e
commit
f9229b5998
@ -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 contact_form = document.getElementsByClassName('content__contact_form')[0];
|
||||||
const subject = document.getElementsByClassName('contact_form__subject')[0];
|
const subject = document.getElementsByClassName('contact_form__subject')[0];
|
||||||
const message = document.getElementsByClassName('contact_form__message')[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) {
|
window.addEventListener('DOMContentLoaded', function(event) {
|
||||||
let formData = new FormData();
|
let formData = new FormData();
|
||||||
formData.append('action', 'start_session');
|
formData.append('action', 'start_session');
|
||||||
fetch(ajaxUrl, {
|
fetch(contactFormAjaxUrl, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
mode: 'same-origin',
|
mode: 'same-origin',
|
||||||
body: formData,
|
body: formData,
|
||||||
@ -39,7 +39,7 @@ contact_form.addEventListener('submit', function(event) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch(ajaxUrl, {
|
fetch(contactFormAjaxUrl, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
mode: 'same-origin',
|
mode: 'same-origin',
|
||||||
body: formData,
|
body: formData,
|
||||||
|
Loading…
Reference in New Issue
Block a user