Solved! Attached the sendEmail function to an event and used e.preventDefault() to prevent the default form submission behavior:
emailjs.init({ publicKey: '*' });
const sendEmail = (e) => { e.preventDefault();
var emailData = {
name: 'Konstantinos Iakovou | Web developer',
notes: 'Check this out!',
};
emailjs.send('service_*', 'template_*', emailData).then(
(response) => {
alert('Message successfully sent!');
},
(error) => {
console.error('Failed to send the message:', error);
alert(`Failed to send the message: ${error.text}`);
},
);
};