MVC5 app I am refreshing a partial view every 5 seconds however after a few minutes or so the app is hanging with clientside browser error of
net::ERR_INSUFFICIENT_RESOURCES
The code to call the partial is here
function setupRefresh() {
$.ajaxSetup({ cache: false });
// ajax load partial view
$("#PartialViewPlaceHolder").load("/testController/GetTestPartialView");
// refresh count every 5 seconds
$(function() {
window.setInterval(setupRefresh, 5000);
});
}
The code for my partial is
<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("Do something", "GetPartialView", "TestController", new {@class = "modal-link btn btn-primary btn-lg btn-block"}) }
this fragment must be outside of setupRefresh()