【发布时间】:2011-03-24 16:39:01
【问题描述】:
我无法从多页布局表单提交的 AJAX 响应链接回主页
结构
index.php有多页协议(index.php#agreement)
#agreement 有一个使用默认 AJAX 调用提交到 (agreement.php) 的表单
从agreement.php 我可以回到预期的最后一页(#agreement),但现在我想回到index.php 页面。
我可以轻松输入href="index.php",但随后会话失去了它的价值。
有没有办法倒退两步?或访问 URL 历史记录并指向特定页面而不丢失表单中的任何数据?
我已经在index.php 中使用此代码绑定了agreement.php
$('#agreement_status').live('pageshow',function(event, ui){
// Button action
$('#back_home').click(function(){
window.history.back(); // this goes back one page to index.php#agreement
window.history.back(-2); // this goes back one page to index.php#agreement
$.mobile.changePage("#index", "slideup"); // this works but appends the hashtag in the URL which breaks the other functionality
});
});
在agreement.php我有这个代码
<a id="back_home"
data-role="button"
data-icon="home"
data-theme="z"
data-inline="true"
style="float:right;">
Home
</a>
【问题讨论】:
-
我目前在 changePage 中遇到了类似的问题,它可以正确重定向,但会在 URL 中留下一个标签,这会破坏一切。如果我找到解决方法,我会告诉你的。
-
他们刚刚发布了ver a4,所以我很快就会测试它
标签: jquery ajax history jquery-mobile