I have searched up and down and have yet to find something that will allow setInterval to work in any version of Internet Explorer.
Below is the code I am using right now...
<script type="text/javascript">
$(document).ready(function () {
$('#varRefresh').load('reload.php');
window.setInterval("refreshVar();", 5000); //**** every 5 seconds
});
function refreshVar() {
$('#varRefresh').load('reload.php');
}
</script>
<div id="varRefresh">
</div>
Can anyone point me in the right direction so I can get it to work in IE?
The page you're trying to load may simply be cached.
You can force Internet Explorer not to cache pages as follows: Prevent caching of pages in Internet Explorer 8.
Alternatively, you may simply append a timestamp to the URL; because the URL is new to IE, it will always load the latest version.
$(document).ready(function () {
$('#varRefresh').load('reload.php?'+new Date().getTime());
window.setInterval(refreshVar, 5000); //**** every 5 seconds
});
function refreshVar() {
$('#varRefresh').load('reload.php?'+new Date().getTime());
}
Try replacing this line:
window.setInterval("refreshVar();", 5000); //**** every 5 seconds
with this:
window.setInterval(refreshVar, 5000); //**** every 5 seconds
(making the first argument a function reference instead of a string)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With