2012-02-20 45 views
0

我想知道如何使用頁面和多個對話框加載外部頁面。加載包含多個數據部分的外部文件

//I am in index.htm, a multi-page file which will send a big object to anotherpage.htm 
$.mobile.changePage(anotherPage.htm, {type:"post",data:formData}) 

這將使帖子很好,並通過formData。但是,anotherPage.htm中的對話框不可用。如果我直接訪問anotherPage.htm,則頁面按預期運行。按照預期,jQM只能在另一個頁面中找到的第一頁加載。

//anotherpage.htm 
<div data-role="page" id="mypage"> 
    <p id="something">Some thing</p> 
    <script> 
    //bind to the pageinit event to fire the email handling. 
    $("#something").live("click", function() { 
     $.mobile.changePage('#successDialog',{ transition: "pop", role: "dialog", reverse: false }); 
    }); 

</script> 
</div> 
<div data-role="dialog" id="successDialog" > 
    <p>Success!</p> 
</div> 
<div data-role="dialog" id="failureDialog" > 
    <p>Failure!</p> 
    <a id="dialogClose" href="#" data-rel="back" data-role="button">Close</a> 
</div> 
+0

我認爲當我嘗試傳統提交而不是更改頁面時,我處於正確的軌道上。我沒有做的是將數據對象附加到正確提交,如此處所示。 http://stackoverflow.com/questions/2530635/jquery-add-additional-parameters-on-submit-not-ajax – 2012-02-20 16:50:40

回答

0

不幸的是,當你阿賈克斯加載只吸入您請求的頁面多頁面模板,你有你的對話與同一頁和散列頁分離出來爲獨立的文件或引用這些對話編號