Hello,
my application (ASP.NET MVC) shows a page which loads data constantly, at certain intervals.
The jQuery script calls a controller and this one renders a different partial view, based on certain conditions.
This partial view is the appended to the DOM with jQuery; previous elements are removed with the empty() method.
$(document).ready(function() {
var ScheduledAction = function(func, times, interval) {
var ID = window.setInterval(function(times) {
return function() {
if (times > -1) {
if (--times <= 0)
window.clearInterval(ID);
}
func();
}
} (times), interval);
};
ScheduledAction(function() {
LoadAppointments();
}, -1, <%=Model.RefreshTimeout %>);
});
function LoadAppointments() {
$("#AppointmentsList").empty();
$('#loading').html("<img src='Images/bigloader.gif' />");
$.get(UrlAction,
function(data) {
if (data != '') {
$('#AppointmentsList').append(data);
$('#loading').empty();
}
else {
$('#loading').fadeOut(3000, function() { $('#loading').empty(); });
}
});
}
The controller (UrlAction) returns a partial view. For Each roundtrip the partial view is different. Once the partial view contains just an image. In the other situation is a div with some infos.
I've realized that after one day the browser loads something like 600Mb of memory. What am I doing wrong?
Thanks
Alberto