function getUserCount() { $.getJSON(pagePath + '/getUserCount.do', function(data) { .... setTimeout(function() { getUserCount(); }, 3 * 60 * 1000); }); }