I'm am very new to javascript programming and am trying to autorefresh some layers in my web map. I've attached my code...any insight would be extremely helpful.
The logic looks right. Some things to look at: 1. The syntax of setInterval function: http://www.w3schools.com/jsref/met_win_setinterval.asp 2. Make sure you understand the variable scope in JavaScript: http://stackoverflow.com/questions/500431/javascript-variable-scope In your code, you cannot access those layers which you created in another function, because they are the local variables. You can either set them as global variables, (normally, you should avoid doing so), or pass it as an argument.
The logic looks right. Some things to look at: 1. The syntax of setInterval function: http://www.w3schools.com/jsref/met_win_setinterval.asp 2. Make sure you understand the variable scope in JavaScript: http://stackoverflow.com/questions/500431/javascript-variable-scope In your code, you cannot access those layers which you created in another function, because they are the local variables. You can either set them as global variables, (normally, you should avoid doing so), or pass it as an argument.
Did you mean to mark your post as the answer to this thread? If anything, it seems like Jian's post is more appropriate to be marked as the answer for this thread. If his post didn't help, please add specifics to your post about what you did to address your problem.