Skip to content

Instantly share code, notes, and snippets.

@AverageMarcus
Created March 28, 2013 12:47
Show Gist options
  • Save AverageMarcus/5262845 to your computer and use it in GitHub Desktop.
Save AverageMarcus/5262845 to your computer and use it in GitHub Desktop.
JavaScript polling every 5 seconds
(function pollForUpdate(){
setTimeout(function(){
$.post('/some/url/', function(data){
//process data
pollForUpdated();
});
}, 5000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment