使用jQuery重定向 [英] Redirect Using jQuery

查看:100
本文介绍了使用jQuery重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在将jquerymobile用于正在创建的应用程序.我有一个链接,如果所有验证都通过,我想通过,但是如果失败,我想重定向.

So I'm using jquerymobile for an app I'm creating. I have a link that if all the validation passes I'd like to go through, but if something fails I'd like to redirect.

在jquery中,类似这样的东西.由于它是jquerymobile,因此链接将在同一index.html页面上是一个新的div-如果有帮助的话.

In the jquery something like this. Since it is jquerymobile the link will be a new div on the same index.html page - if that helps.

$(#link).click(function(){  
  if(validation_fails) link_elsewhere;  
  else return true;
}

推荐答案

您可以使用window.location重定向浏览器:

You can use the window.location to redirect a browser:

https://developer.mozilla.org/en/DOM/window.location

这篇关于使用jQuery重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆