如何使用JavaScript刷新页面?
当前回答
简单的Javascript解决方案:
location = location;
<buttonClick=“location=location;”>重新加载</button>
其他回答
这对我有用。
function reload(){
location.reload(true);
}
$(document).on("click", "#refresh_btn", function(event)
{
window.location.replace(window.location.href);
});
我想有很多方法会奏效:
window.location.reload();history.go(0);window.location.href=window.location.html;
您可能需要使用
location.reload()
或可能需要使用
location.reload(forceGet)
forceGet是一个布尔值,也是可选的。
如果您希望强制浏览器从服务器获取页面,以便同时清除缓存,请将此参数设置为true
jQueryLoad函数还可以执行页面刷新:
$('body').load('views/file.html', function () {
$(this).fadeIn(5000);
});