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

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

c# - Create a Notification Object (Email or Page) At Run Time -- Dependency Injection or Factory -

Set Up Of Common Name Of SSL Certificate To Protect Plesk Panel -