它确实加载了一个新页面并且网址确实更新了,但是当我按下后退按钮时,只有网址已更改而没有刷新但内容却没有.
$('button').click(function(){
window.history.pushState({}, '', 'page2.php');
$('body').html('<div class="loading.gif"></div>');
//Load Page
$.get('page2.php', function(data){
$('body').html(data);
};
//Edited
$(window).bind('popstate', function(){
//What should I code here??
});
});
Run Code Online (Sandbox Code Playgroud)