Question:
Login to See the Rest of the Answer
Answer: It looks like at the second iteration the totalCasesChart variable is already disposed from the DOM context. That is why you are having that error because there is no document.ready function. Pretty much, when the page refreshes, the browser has to parse the javascript again or worse even repaint the whole DOM Elements.
I suggest you use jQuery with a delay see the code below.
$(document).ready(function () {
var delay = 5000;
setTimeout(function () { window.location = '/YourPageHere'; }, delay);
});
The code above still executes even when the page reloads. Overall, this is a bad practice and would consume a lot of resources.
Best case, you should look into pushing the content to the UI whenever it is available at the Server side, this way you don't put much stress on the Browser asking for data every after an interval elapses. Don't use JavaScript, it is pain.