Last active
May 24, 2019 10:06
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some randmom text probably |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment