Friday, 23 August 2013

Try the combination of setTimeout function and .load function

Try the combination of setTimeout function and .load function

I have a problem with the following code. I want to show the index of a
file (test.txt) as it changes. While it works using Mozilla,with IE9 it
seems that the settimeout() doesn't work.
<div id="auto">xxx</div>
<script type="text/javascript" src="jquery-1.10.2.min.js"></script>
<script type="text/javascript">
$(document).ready( function () {
$('#auto').load('test.txt');
refresh1();
});
function refresh1() {
setTimeout ( function() {
$('#auto').load('test.txt');
refresh1();
},200);
}
</script>

No comments:

Post a Comment