[英]Auto refresh in mvc view Not partial view instead the main view
I have a mvc view which i need to refresh after every two seconds , basically i do not have only static data onto the view instead i have data which is coming from the db on each refresh i am using below code我有一个 mvc 视图,我需要每两秒刷新一次,基本上我在视图上没有只有静态数据,而是在每次刷新时都有来自数据库的数据,我正在使用下面的代码
<script type="text/javascript">
function timedRefresh(timeoutPeriod) {
setTimeout(function () {
location.reload(true);
}, timeoutPeriod);
}
<meta http-equiv="refresh" content="2" />
Response.AddHeader("Refresh", "5"); Response.AddHeader("刷新", "5");
but the issue is on IE and firefox it shows screen flickers so how to solve it但问题出在 IE 和 Firefox 上,它显示屏幕闪烁,所以如何解决
Enable browser caching and use jquery to update page dynamically through call back.开启浏览器缓存,使用jquery通过回调动态更新页面。 Reload is just a very expensive and nit recommended approach here.
重新加载只是一种非常昂贵且不推荐的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.