JavaScript的code刷新页面,或电网的Telerik [英] JavaScript code to refresh page and or telerik grid

查看:117
本文介绍了JavaScript的code刷新页面,或电网的Telerik的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要某种code,这将刷新页面每隔5分钟,如果不是页面然后就因为这显示它的网格的Telerik的所有这一切RLY需要。

I need some kind of code which will refresh the page every 5min and if not the page then just the Telerik grid displayed on it since that's all that's rly needed.

唯一的另一件事是,如果这是可能的话在页面上没有任何活动的5分钟后,但它不是核心功能。

Only other thing would be if it was after 5min of no activity on the page if possible but it's not core feature.

推荐答案

一种可能是使用元刷新标记:

One possibility is to use a meta refresh tag:

<meta http-equiv="refresh" content="300" />

另一种可能性是使用 window.setInterval 方法定期AJAX请求发送到控制器动作和更新DOM的:

Another possibility is to use the window.setInterval method to send periodic AJAX requests to a controller action and update the DOM:

window.setInterval(function() {
    // Send an AJAX request to a controller action which will
    // return a partial with the grid and update the DOM
    $.ajax({
        url: '/grid',
        success: function(result) {
            $('#someGridContainer').html(result);
        }
    });
}, 300000);

和落实闲置功能,您可以使用的jQuery插件闲置

And to implement the idle functionality you could use the jquery idle plugin.

这篇关于JavaScript的code刷新页面,或电网的Telerik的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆