On my contact form
http://new.coronadofol.org/new/contact.php
I’m trying to use AJAX to handle the form
<script>
$('#contact_fol').submit(function(e) {
// prevent form submit
e.preventDefault();
formData = new FormData($(this)[0]);
$.ajax({
url: 'php/contact_engine.php',
type: 'POST',
dataType: 'json',
data: formData,
processData: false,
contentType: false,
success: function(data)
{
if(data.error) {
// Show errors
$('#contact_result').html(data.error);
}
else if(data.success) {
// Show success message
$('#contact_result').html(data.success);
//Put here the code to reset the fields of your form
}
else {
window.location.reload();
}
},
error: function(data)
{
// Something went wrong
$('#contact_result').html('<div class="error"><h4>Error</h4><p>Something went wrong.</p></div>');
}
});
});
</script>
When I submit the form
So I’m guessing there is an error somewhere.
But when I check the console, I see no mention of it.
How can I tell?