MVC5应用程序我每隔5秒刷新一次局部视图但是几分钟后左右应用程序挂起了客户端浏览器错误
净:: ERR_INSUFFICIENT_RESOURCES
调用partial的代码在这里
function setupRefresh() {
$.ajaxSetup({ cache: false });
// ajax load partial view
$("#PartialViewPlaceHolder").load("/testController/GetTestPartialView");
// refresh count every 5 seconds
$(function() {
window.setInterval(setupRefresh, 5000);
});
}
我的部分代码是
<div class="col-md-12">
@if (Model.TestCount > 0)
{
<p class="alert alert-info">
There are <strong>@Model.testCount</strong> widgets in this batch
</p>
@ShowButton()
}
else
{
<p class="alert alert-info">
There are no widgets
</p>
}
</div>
@helper ShowButton()
{ @ Html.ActionLink(&#34;做点什么&#34;,&#34; GetPartialView&#34;,&#34; TestController&#34;,新{@class =&#34; modal-link btn btn-primary btn -LG btn-block&#34;})}
答案 0 :(得分:3)
此片段必须在setupRefresh()
之外$(function() {
window.setInterval(setupRefresh, 5000);
});