Need help with setTimeout and arrays
Basically on the load of a page I am making an ajax call that returns a string with integers seperated by commas. I have verified that the returns from the ajax call are working correctly, but then I am trying to take that string, break it into an array, and use the values in that array to use setTimeout and call the function at those intervals.
Here's my code:
This is on a test page, so for testing purposes I'm just updating the div with the current array index to verify it's cycling through the array, which it's not.
//Create our array outside of a function so it's available
var wait_time = new Array();
//function that handles the ajax return
wait_time = str.responseText.split(',');
//Function that changes the div html with new information
function update_current_show(array_index, wait_time)
$("currently_playing").innerHTML = array_index;
var next_index = array_index + 1;
setTimeout('update_current_show(next_index, wait_time)', 3);