jQuery Mobile Page refresh mechanism

前端 未结 6 1179
小鲜肉
小鲜肉 2020-11-30 02:23

I\'m having a lot of pain understanding how jQuery Mobile handles pages refresh after an ajax update.

I\'m having a two pages - unique file site: a search engine.

6条回答
  •  日久生厌
    2020-11-30 02:44

    I found this thread looking to create an ajax page refresh button with jQuery Mobile.

    @sgissinger had the closest answer to what I was looking for, but it was outdated.

    I updated for jQuery Mobile 1.4

    function refreshPage() {
      jQuery.mobile.pageContainer.pagecontainer('change', window.location.href, {
        allowSamePageTransition: true,
        transition: 'none',
        reloadPage: true 
        // 'reload' parameter not working yet: //github.com/jquery/jquery-mobile/issues/7406
      });
    }
    
    // Run it with .on
    $(document).on( "click", '#refresh', function() {
      refreshPage();
    });
    

提交回复
热议问题