如何使用JavaScript刷新页面?


当前回答

jQueryLoad函数还可以执行页面刷新:

$('body').load('views/file.html', function () {
    $(this).fadeIn(5000);
});

其他回答

如果当前页面是通过POST请求加载的,您可能需要使用

window.location = window.location.pathname;

而不是

window.location.reload();

因为如果在POST请求加载的页面上调用window.location.reload()将提示确认。

这适用于所有浏览器:

location.reload();

简单的Javascript解决方案:

 location = location; 

<buttonClick=“location=location;”>重新加载</button>

你们可能需要使用

    location.reload(forceGet)

forceGet是一个布尔值,也是可选的。

默认值为false,这将重新加载缓存的页面。

jQueryLoad函数还可以执行页面刷新:

$('body').load('views/file.html', function () {
    $(this).fadeIn(5000);
});