2014-03-19 130 views
0

我需要打開一個頁面,當用戶點擊保存。 但是,頁面打開並返回到顯示當前頁面。它使用我需要的鏈接,但顯示不同的頁面。這意味着如果我點擊刷新它將顯示我需要的頁面。JQM:彈出URL打開url並返回當前頁面?

如何解決? (我需要保存功能,因爲我做了一些Ajax請求得到的數據,不能做HREF = ...,需要來自功能)

調用彈出

<a href="#popupSave" data-rel="popup" data-inline="true" data-icon="check" data-theme="b" data-role="button" data-position-to="window">Save</a> 

彈出

<div data-role="popup" id="popupSave" data-overlay-theme="a" data-theme="c" data-dismissible="false" style="max-width:400px;" class="ui-corner-all"> 
      <div data-role="header" data-theme="b" class="ui-corner-top"> 
       <h1>Save?</h1> 
      </div> 
       <div data-role="content" data-theme="d" class="ui-corner-bottom ui-content"> 
       <h3 class="ui-title">To Save?</h3> 
       <p>This action cannot be undone.</p> 
       <a href="#" data-role="button" data-inline="true" data-rel="back" data-transition="flow" data-theme="c">Cancel</a> 
       <a href="" id="link" onclick="save();" data-role="button" data-inline="true" data-theme="b" >Save</a> <!----> 
       </div> 
      </div> 

js函數

function save(){ 

    $("#popupSave").popup('close'); 
$.mobile.changePage("pro_open.html?flag=change"); 
} 

解決了!!! --->這是:

function save(){ 

    $("#popupSave").popup('close');//<----causing the problem, removed it and it works! 
$.mobile.changePage("pro_open.html?flag=change"); 
} 

回答

0

解決了!!! --->這是:

function save(){ 

$( 「#popupSave」)彈出( '親密'); // < ----造成問題的原因。 ,刪除它,它的工作原理! $ .mobile.changePage(「pro_open.html?flag = change」); }