简体   繁体   English

使用javascript / jquery重定向网址(移动)

[英]redirect url using javascript/jquery (mobile)

I have a problem here: I'm trying out to redirect my ulr to a specific url when a user gets log out(in a form). 我在这里遇到问题:当用户注销(以表格形式)时,我正在尝试将ulr重定向到特定的url。 the problem is that this url: http:champions2017/ have a form to log in and works perfecly well, but whenever a user clicks on log out button, my site redirects the url to http:champions2017/auth/logout where the session is destroyed, and the same log in form is displayed and here the problem comes out, here the user is unable to log in again, so I'm asking if there is a way to redirect to http:champions2017/ once the session is destoyed. 问题是该URL: http:champions2017/具有登录表单并可以正常运行,但是每当用户单击注销按钮时,我的网站都会将该URL重定向到http:champions2017/auth/logout ,该会话将被销毁,并且显示相同的登录表单,并且这里出现问题,这里用户无法再次登录,所以我问一旦保存会话,是否可以重定向到http:champions2017/ I know I can use location.href or a header(location) in php but no, I already did something like this: https://api.jquerymobile.com/navigate/ but no. 我知道我可以在php中使用location.hrefheader(location) ,但没有,我已经做了类似的事情: https : //api.jquerymobile.com/navigate/但没有。

For redirect the page you can to use jQuery: 要重定向页面,您可以使用jQuery:

window.location.href="http:champions2017/";
window.location.replace("http:champions2017/");

You also can create fn() and call them as require. 您还可以创建fn()并根据需要调用它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM