Using setInterval() to do simplistic continuous polling
From my comment: I would use setTimeout [docs] and always call it when the previous response was received. This way you avoid possible congestion or function stacking or whatever you want to call it, in case a request/response takes longer than your interval. So something like this: function refresh() { // make Ajax call here, … Read more