【问题标题】:jQuery Mobile Reload Page Depending on Div ContentsjQuery Mobile 重新加载页面取决于 Div 内容
【发布时间】:2013-03-31 05:24:58
【问题描述】:

我正在使用 jQuery Mobile,如果 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);
       }
   });

    }
});

有什么想法吗?谢谢!

【问题讨论】:

    标签: javascript jquery ajax jquery-mobile


    【解决方案1】:

    这可能会对您有所帮助:

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

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

    这里是documentation。

    【讨论】:

      猜你喜欢
      • 2014-07-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-14
      • 2015-10-19
      相关资源
      最近更新 更多