It’s picking up the php error code, but not the javascript. It worked before, but then I did something and it doesn’t work anymore.
$(function() {
// Get the form.
var form = $('#ajax-contact');
// Get the messages div.
var formMessages = $('#form-messages');
// Set up an event listener for the contact form.
$(form).submit(function(e) {
// Stop the browser from submitting the form.
e.preventDefault();
// Serialize the form data.
var formData = $(form).serialize();
// Submit the form using AJAX.
$.ajax({
type: 'POST',
url: $(form).attr('action'),
data: formData
})
.done(function(response) {
// Make sure that the formMessages div has the 'success' class.
$(formMessages).removeClass('error');
$(formMessages).addClass('success');
// Set the message text.
$(formMessages).text(response);
// Clear the form.
$('#name').val('');
$('#email').val('');
$('#message').val('');
})
.fail(function(data) {
// Make sure that the formMessages div has the 'error' class.
$(formMessages).removeClass('success');
$(formMessages).addClass('error');
// Set the message text.
if (data.responseText !== '') {
$(formMessages).text(data.responseText);
} else {
$(formMessages).text('One or more field(s) is missing.');
}
});
});
});
yes there is an error message, but it’s picking up the php error message instead of the javascript error message. The error message suppose to have a red background.
Failed to load resource: the server responded with a status of 404 (Not Found)
http://f6-preview.awardspace.net/thegroupeezz.dx.am/groupeezz11/js/jquery.creative.js
Uncaught SyntaxError: Unexpected token ILLEGAL
index.html:270