Categories
JavaScript Answers

How to do page redirect with successful ajax request with JavaScript?

Spread the love

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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *