I use setInterval() to get the newest datas and draw something at set intervals.But in IE,it only works one time,I searched it in google,it says the cache of IE may be a problem,so I added a time stamp to my url like this:
url+"?"+Math.random();
But it still doesn’t work,or I made some mistakes?
I changed another way to write my function,the former codes are:
$(document).ready(function()){
autoRefreshFunction(some parameters){
var interval=setInterval(
function(){
main function that gets data and draw
},time_interval);
}
}
It only work one time in IE,but chrome is ok.
The new codes are:
$(document).ready(function()){
var interval=setInterval(
function(){
main function that gets data and draw
},time_interval);
}
It works in IE,so I am confused about the difference between this two method.
I think this might be your problem:
You’re closing the parenthesis to
readytoo soon. I think you want:IE may have been confused by that. Also, in your original code you had:
It looks like you were sort of defining a function called
autoRefreshFunction, but incorrectly since you forgot the function keyword.I think the end result should be: