I\'m having problems redirecting the user to a thank you page after a successful form completion. What happens is that after the form submits, it goes to a blank page (https
Your success callback syntax is incorrect. It should rather be:
$('#theForm').ajaxForm(function() {
window.location.href = "/path/to/thankyoupage";
});
Also, note that it is window.location.href
and not location.window.href
This is a jQUery Solution:
window.location("www.example.com");
//Please try this
<script src="http://malsup.github.com/jquery.form.js"></script>
<script>
$(document).ready(function() {
$('#theForm').ajaxForm(function() {
alert('form was submitted');
});
success:function(response) {
if(response){ // check whether response is received
location.window.href = "http://your_domain_name/thank-you";}
}
});
</script>
you can try like this :
success: function (data) {
window.location.href = data.redirecturl;
},
error: function () {
alert('error happened');
}
The follow code worked for me, in a complete different context of the OP:
$(document).ready(function() {
window.location.href = "URL";
});
Should be
window.location = "http://www.google.com";