jQuery移动重载页面取决于Div内容



我正在使用jQuery移动和我有麻烦重新加载一个页面,如果一个div内的文本等于一定的值。div的内容是用AJAX加载的。div的内容正在通过AJAX更新,但是我不知道为什么当内容等于"您的项目已过期"时页面没有重新加载。

 $(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);
       }
   });
    }
});

任何想法?谢谢你!

这可能对你有帮助:

.changePage()代替window.location.assign

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

最新更新