Skip to content

Instantly share code, notes, and snippets.

@aaronmccall
Created July 2, 2012 17:57
Show Gist options
  • Save aaronmccall/3034607 to your computer and use it in GitHub Desktop.
Save aaronmccall/3034607 to your computer and use it in GitHub Desktop.
a periodic ajax update with jQuery
$(function () {
setInterval(function () {
$.post('/has-changed', function (data) {
if (data == '1') {
$(document.body).css('backgroundColor', 'red');
}
});
}, 15);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment