This commit is contained in:
Donavon McDowell 2023-08-22 16:45:29 -06:00
parent bb54c951ee
commit bb36976fff

View File

@ -15,10 +15,10 @@
name,
body
};
var name = document.getElementById('name');
var body = document.getElementById('body');
var nameValue = document.getElementById('name');
var bodyValue = document.getElementById('body');
if (name.value !== '' && body.value !== '') {
if (nameValue.value !== '' && bodyValue.value !== '') {
try {
const response = await fetch('https://helpdeskapi.mpe.ca/api/message', {
method: 'POST',
@ -31,8 +31,8 @@
if (response.ok) {
console.log('POST request successful');
toastr.success('One of the members of the IT department will contact you shortly', 'Message sent!');
body.value = '';
name.value = '';
nameValue.value = '';
bodyValue.value = '';
} else {
console.error('Error:', response.status);
toastr.error('Error: ' + response.status, 'Message not sent');