Below is the JS:
function sendEmail(event) {
event.preventDefault();
var $name = $('#name');
var $email = $('#email');
var $phone = $('#phone');
var $message = $('#message');
if (isNotEmpty($name) && isNotEmpty($email) && isNotEmpty($phone) && isNotEmpty($message)) {
$.ajax({
url: 'sendEmail.php',
method: 'POST',
dataType: 'json',
data: {
name: $name.val(),
email: $email.val(),
phone: $phone.val(),
message: $message.val()
}, success: function (response){
console.log(response);
}
})
}
}
The browser says sendEmail.php is not found.
jquery.min.js:2 POST http://localhost:3000/sendEmail.php 404 (Not Found)
This is the folder structure of my project:
The js code is from the file assets/mail/contact_form.js
and the sendEmail.php
is at the src folder.