drzdu44226 2015-01-11 10:54
浏览 88

如何使用jQuery Mobile的$ .mobile.navigate在导航后更改URL

I'm new to jQuery Mobile and I've been trying so hard (been googling for 2 days straight) to understand how the navigation to external pages works but finding it really hard so hopefully I can get a proper explanation here. From my searches I've found the $.mobile.navigate function but I haven't quite figured out how exactly to use it.

Basically what I have is a login.php page, after you successfully logged in you should be taken to the homepage.php, I've managed to make it so that the homepage.php's content is shown, but when it comes to the URL I can see for a split second that it changes to homepage.php but immidiately changes back to login.php. How can I make it so that it stays on homepage.php?

I navigate to homepage.php with $.mobile.navigate like so:

<input type="submit" form="login-form" name="submit_login" value="Logga in" id="submit-login">

$('body').on('click', '#submit-login', function() {
    $.mobile.navigate('../../includes/pages/homepage.php');
});

And currently my homepage.php file looks like this:

<div data-role="page" data-url="homepage" data-theme="b" id="homepage">
    <div data-role="header">Some content here</div>
    <div data-role="main">Some content here</div>
    <div data-role="footer">Some content here</div>
</div>

I read somewhere that data-url is used for changing the url on navigation but I haven't been able to make any use of it from my attempts.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 2024-五一综合模拟赛
    • ¥15 下图接收小电路,谁知道原理
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度
    • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
    • ¥15 ETLCloud 处理json多层级问题
    • ¥15 matlab中使用gurobi时报错
    • ¥15 这个主板怎么能扩出一两个sata口
    • ¥15 不是,这到底错哪儿了😭