Just to help update this post.
Encapsulate with:
$(document).ready(function() { ALL YOUR CODE GOES HERE }
Remove submitHandler from the rules:
rules: { name: {required: true}, email: {required: true}, subject: {requred: true} }, submitHandler: function(form) {.....
Add cache: false to prevent the form from being returned as a cache:
request = $.ajax({ type: "POST", cache: false, url: "<?php bloginfo("template_directory"); ?>/contact/process.php", data: $(form).serialize(), timeout: 3000 });
Use done () and fail () instead of success and error:
// Called on success. request.done(function(msg) { alert('works'); }); // Called on failure. request.fail(function (jqXHR, textStatus, errorThrown){ alert('failed'); // log the error to the console console.error( "The following error occurred: " + textStatus, errorThrown ); });
Everybody is here:
$(document).ready(function() { $("#contact").validate({ rules: { name: {required: true}, email: {required: true}, subject: {requred: true} }, submitHandler: function(form) { request = $.ajax({ type: "POST", cache: false, url: "<?php bloginfo("template_directory"); ?>/contact/process.php", data: $(form).serialize(), timeout: 3000 });
Add a no-cache header to the process.php header to prevent browser form caching:
<?=header("cache-control: no-cache");?>