HTML code:
div id="updatePanel">
jQuery code:
var data=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
$.each(data, function(index, value) {
setTimeout(function(){
$('#updatePanel').text(index);
}, 5000 );
});
I want the updatePanel div content to be updated every 5 seconds. It should be 1 then wait 5 seconds, display 2, wait for another 5 seconds......
It doesn't work like what i expected. It waits for 5 seconds and display 9.
See the demo here: http://jsfiddle.net/vc7qB/4/