jQuery/Ajax - Redirect to another page after succes message
13,623
Alright, after trying hard I just came up this and it worked:
jQuery( document ).ajaxSuccess(function( event, xhr, settings ) {
window.location.href = 'http://google.com';
});
Becuase, I wanted to be redirected after the successful AJAX request is complete.
Author by
Faizan Ali
Freelance front-end and back-end web developer with WordPress Development as core interest.
Updated on June 04, 2022Comments
-
Faizan Ali almost 2 years
I want to redirect the user after filling up the contact form and the success message appears.
Here's the HTML code:
<div id="wpm_download_1" style="display: inline;"> The link to the file(s) has been emailed to you. </div>
and here's the JavaScript I'm trying:
function() { var isDownloaded = jQuery('#wpm_download_1').text(); if (typeof obj.isDownloaded != 'undefined'){ window.location = 'http://google.com'; } }
Basically, I want to redirect the user when this message appears after sending form data through
AJAX
:The link to the file(s) has been emailed to you..