Skip to content

Instantly share code, notes, and snippets.

@dbednall
Last active May 24, 2019 10:06
Show Gist options
  • Save dbednall/7107791545a3ef1ce3a95026f514908c to your computer and use it in GitHub Desktop.
Save dbednall/7107791545a3ef1ce3a95026f514908c to your computer and use it in GitHub Desktop.
Page with jquery to repeatedly ajax on some milisecond interval and update a div with the contents of info.txt
<html><head><title>refresher</title><script src="http://code.jquery.com/jquery-latest.js"></script><script>
(function($){
$(document).ready(function(){
$.ajaxSetup({
cache: false,
});
function update(){
$("#the_div").load('info.txt').unwrap().wrap('<h1></h1>');
$("#stamp").text(Date().toLocaleString());
}
setInterval(update, 500); // ms
});
})(jQuery);
</script></head><body><hr><p>In my file, I have:</p><div id="the_div"></div><hr><p id="stamp" style="font-style:italic"></p></body></html>
Some randmom text probably
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment