2013-03-31 66 views
0

我正在使用jQuery Mobile,並且在div內的文本等於某個值時無法重新加載頁面。 div的內容用AJAX加載。 div的內容正在通過AJAX更新,但我不知道當內容等於「您的項目已過期」時,爲什麼不重新加載頁面。jQuery Mobile Reload Page取決於Div內容

$(document).on('pagebeforeshow', '#listitem', function(event){  
     $(document).ready(function(){ 
     refreshTable(); 
    }); 

    function refreshTable(){ 

    $('#tableHolder').load('ajax_item_time.php', function(){ 
     if($("#tableHolder").text() == "Your item has expired."){ 
     window.location.assign("mobile_list.php") 
     } 
     else { 
     setTimeout(refreshTable, 5000); 
     } 
    }); 

    } 
}); 

任何想法?謝謝!

回答

1

這可以幫助你:

使用.changePage(),而不是window.location.assign

$.mobile.changePage("#YOUR_PAGE_ID"); 

這裏是documentation