我試圖用ajax重新加載頁面。網址中包含哈希(ANCOR)window.location.reload不考慮散列在ie
index.php?page=2&obj=3#lb
我試圖用location.reload()或windows.location.reload(真)
$(".reload").click(function(){
var userid = $(this).attr('userid');
$.post("testpost.php", {userid:userid}, function(data){
//window.location.reload(true);
location.reload();
});
});
隨着FF,Chrome和Opera的作品完美,但與IE瀏覽器重新加載頁面時(即使在瀏覽器的URL中有散列),ancor不被考慮,頁面從上面查看。我怎麼能解決這個問題?由於
編輯
$(document).ready(function() {
$(".reload").click(function(){
var userid = $(this).attr('userid');
$.post("testpost.php", {userid:userid}, function(data){
location.reload();
});
});
var hash, el;
if(hash = location.hash.substring(1) && el = document.getElementById(hash)) {
el.scrollIntoView(true);
}
});
你有一個URL你可以分享,所以我可以試試嗎? –