javascript - pagination links with ajax back button not going back -
javascript - pagination links with ajax back button not going back -
i'm trying create pagination links work ajax , updating url works fine when clicking url updates not page
$(document).on('click','.pagination ul li a',function(){ var thisurl = $(this).attr('href'); $.get(thisurl,function(data){ $('.news_archive').html( $(data).find('.news_archive').html() ); history.pushstate(null, "a pagination link!", thisurl); }) homecoming false; });
you can listening hashchange event instead of click:
$(window).hashchange(function() { var thisurl = window.location.hash; $.get(thisurl, function(data) { $('.news_archive').html( $(data).find('.news_archive').html() ); }) });
and set hash in link :
<a href="#yourlink">link</a>
javascript jquery html css
Comments
Post a Comment