如何刷新DOM(并在访问另一个页面后获得正确的URL)Jquery mobile


how to refresh the DOM (and have the right URL after beeing on another page) Jquery-mobile

您好,我正在学习Jquery mobile,我遇到了一件简单的事情,也许应该在一分钟内解决。

我制作了一个简单的2页网站,所有窗口都是单个HTML页面,所以我有index.php、contacts.php和sendmail.php(仅用于邮寄目的)。

我顺利地从索引导航到联系人,然后我填写表格并单击提交,sendmail.php有一个header:('location:'),在发送邮件后将用户重定向到index.php,但当我回到index.php时,导航栏指向"sendmail.php",这是不对的。有没有一种方法可以轻松地更改它(也许可以重新加载页面)?表单操作如下:

<form action="sendmail.php" method="POST">

从一个页面到另一个页面的链接如下:第一页:

<script type="text/javascript">
 $( function() {   
  $('body').bind( 'swipe', function( e ) {
    $.mobile.changePage( "contatti.php", {      
       transition: "slide", 
       reverse: true, 
       changeHash: false,
       reloadPage: true      
   });
  } ); 

} );

 </script>
<a data-role="button" data-transition="flip" href="contatti.php" data-icon="info"
        data-iconpos="left" class="ui-btn-right" data-prefetch="true">
            Info
        </a>

然后是所描述的操作,当我回到第一个页面时,我有这样的url:

/mobile/#/mobile/sendmail.php

您可以随时修改window.location.hash = '';