0

I want my grid to periodically reload and get the data from the url that i specify. Every 5 seconds, i want the grid to get the current data from the url. I have already tried using setInterval and window.timeout but when i do, the grid reloads the data from the browser cache. It does not invoke the url to get the new data.

Is there a way to make the grid reload and get the new data from the url at specific time intervals ?

Basically, i want the reload button to fire automatically every 5 seconds. How can I do this ?

please help

thanks

4

2 回答 2

1

您需要的是使用您以前使用过的相同方法,但要防止浏览器的缓存。这样做的一种方法是在服务器端,将no-cache标头添加到该请求的 HTTP 响应中。

另一种方法是更改​​请求的 URL,这样浏览器就不会查找它的缓存。一个例子是:

var url = "..."; // Your URL
url += "&nocache=" + (new Date()).getTime();
于 2013-08-06T21:34:01.750 回答
0

谢谢,

我想出了一个办法:

    window.setTimeout( refreshGrid, 8000);
    function refreshGrid()
    {
    jQuery("#refresh_list").click();
window.setTimeout(refreshGrid, 8000);

     }
于 2013-08-07T14:07:02.220 回答