While setting it up I’ve encountered a problem. The contact form gets sent to the send-mail.php page rather than displaying success notification on the same page as it’s supposed to.
Well I’m not sure why it wasn’t working but I had to change the $.post line in js/send-mail.js to the following and this was the only way I could get it to work:
$.ajax({
data: formValues,
type: $(this).attr(‘method’),
url: $(this).attr(‘action’),
beforeSend:function(){
//dummy info – don’t know why it won’t work without some code here
var x=0;
},
error: function() {
alert(“there was an error”);
},
success: function(data) {
if ( data == ‘success’ )
{
contactForm.find(‘.submit-area’).removeClass(‘loading’).addClass(“success”);
contactForm.clearForm();
}
else
{
contactForm.clearForm();
alert( ‘The sum is incorrect.’ );
}
},
complete: function() {
contactForm.clearForm();
}
});