Sometimes, we want to do page redirect with successful ajax request with JavaScript.
In this article, we’ll look at how to do page redirect with successful ajax request with JavaScript.
How to do page redirect with successful ajax request with JavaScript?
To do page redirect with successful ajax request with JavaScript, we set location.href
to the URL we want to redirect to.
For instance, we write
location.href = "http://www.example.com/ThankYou.html";
to set location.href
to the URL we want to go to.
Conclusion
To do page redirect with successful ajax request with JavaScript, we set location.href
to the URL we want to redirect to.