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