Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 3 ASP.NET MVC3中是否有计时器功能?_Asp.net Mvc 3_Jquery_Timer - Fatal编程技术网

Asp.net mvc 3 ASP.NET MVC3中是否有计时器功能?

Asp.net mvc 3 ASP.NET MVC3中是否有计时器功能?,asp.net-mvc-3,jquery,timer,Asp.net Mvc 3,Jquery,Timer,我正在寻找一种每隔N秒调用一个函数的方法,以便更新页面上显示的数据 是否有内置的功能来完成此任务,还是我必须自己完成 有和javascript函数。例如: window.setInterval(function() { // this will run on every 10 seconds // Here you can send AJAX requests to your controller actions in order // to refresh some

我正在寻找一种每隔
N
秒调用一个函数的方法,以便更新页面上显示的数据

是否有内置的功能来完成此任务,还是我必须自己完成

有和javascript函数。例如:

window.setInterval(function() {
    // this will run on every 10 seconds
    // Here you can send AJAX requests to your controller actions in order 
    // to refresh some data
}, 1000 * 10);
有两个函数和javascript函数。例如:

window.setInterval(function() {
    // this will run on every 10 seconds
    // Here you can send AJAX requests to your controller actions in order 
    // to refresh some data
}, 1000 * 10);
计时器类别:

using System.Timers;
...

_timer = new Timer(3000); // Set up the timer for 3 seco
_timer.Elapsed += new ElapsedEventHandler(_timer_Elapsed);
_timer.Enabled = true; // Enable it


static void _timer_Elapsed(object sender, ElapsedEventArgs e)
{
   // do stuff
}
计时器类别:

using System.Timers;
...

_timer = new Timer(3000); // Set up the timer for 3 seco
_timer.Elapsed += new ElapsedEventHandler(_timer_Elapsed);
_timer.Enabled = true; // Enable it


static void _timer_Elapsed(object sender, ElapsedEventArgs e)
{
   // do stuff
}