sgi
sgi

Reputation: 2032

How to redirect to root page in jQuery?

I'm now redirecting to main page in my Rails application using

redirect_to root_path

I want to do the same in jQuery.

i.e. window.location.replace("???");

How to do that?

Upvotes: 5

Views: 9366

Answers (1)

user144390
user144390

Reputation: 305

window.location = '/'

Disadvantage in using window.location.replace('/') is user won't be able to press "Back" and go back to the previous page.

Upvotes: 16

Related Questions