I’m attempting to submit a form using the POST method. Upon successful submission, the page should redirect to a designated thank-you page URL. However, despite the form being successfully submitted, the page remains unchanged.
Any help on this would be much appreciated.
Here is the code I tried.
jQuery('.submit').submit(function(e){
e.preventDefault();
var form = jQuery("#form");
var actionURL = form.attr("action");
jQuery.ajax({
type: 'POST',
url: actionURL,
data: form.serialize(),
dataType: 'json',
success: function(json) {
window.location.href = "http://www.google.com/";
}
})
return false;
});