Reputation: 103
I am using the Javascript setInterval to keep polling the server for any updates and refresh the screen with the response from the server. I need to support >IE7, and other major browsers.
The setInterval function is getting fired in all the browsers except IE7 and IE8.
According to the suggestions I saw in other posts I have tried setting cache:false on the ajax requests as well as wrapping the setInterval call in an anonymous function. But none of the suggestions seem to work.
Following is the code I am using:
$(document).ready(function () {
setInterval(pollForServerUpdates, 30000);
});
function pollForServerUpdates() {
$.ajax({ url: $.url("Home/GetUpdates"),
type: "POST",
cache: false,
success: function (result) {
updateTabelWithCurrentStatus(result);
},
dataType: "json"
});
}
I am not sure if I am missing anything here. Any help is very much appreciated. Thanks!
Upvotes: 0
Views: 2891
Reputation: 103
I am putting my comments above as the answer to this question. The issue was happening because "class" seems to be a reserved keyword in IE and causing an error. When creating the element, I wrapped the class keyword in quotes and all is well. Thanks Pointy for asking me to look at the console. @Spudley, thanks for the tip, I will be refactoring my code with your suggestion.
Upvotes: 1