I have got this contact form on a website(it is live www.jacks-barber.co.uk) and I had it working properly, but wanted to make it prettier, with effects.
So i have added an AJAX call on submit, and this is where the issues started.
After submit, a message is generated (we will be in touch soon etc), but I want the submit message to be faded out and then refresh the page.
I have put that refresh part of the code in the callback of the fadeTo method, it even fired once, then I changed something, and it never fired again.
The whole rest works, up until the fade out, have a look, click on menu on the main page, then on “contact/opening” and just click submit(the validation does not work either anymore, not the js part, not the php part, the path to the php file is correct, I have checked).
At this point, I want the page to refresh or the contact page/div to be reset to default, if need be by refreshing, here is the AJAX call
$.ajax({
type: "POST",
url: "/contact.php",
data: dataString,
success: function() {
$('#contactDiv').html("<div id='messageToUser'></div>");
$('#messageToUser').html("<h2>Contact Form Submitted!</h2>")
.append("<p>We will be in touch soon.</p>")
.hide()
.fadeIn(1500, function() {
$('#messageToUser').append("<img id='checkmark' src='http://www.newmommymedia.com/wp-content/uploads/2012/06/TBG-green-checkmark.png' />").delay(2000);
$('#contactDiv').fadeTo(1500,0, function(){
window.history.back(1);
});
});
}
});
The whole function is in the source code, from line 1849.
I have tried $(window).history.back() too, does not work.
If there is another way to reset the contact div, let me know.
AJAX newcomer, I apologize upfront:innocent: