Cycling Through Three Divs in a Loop - Some Divs Not Changing
<p>Hey all! Quick question about user display and javascript. What I want to do is turn off the update arrow gif, display the rotating arrows , do the update , hide the rotating arrows and finally display the gif that says this item is now set. </p>

<p>My problem is that the rotating arrows never display. I put the sleep in there because I thought the update was happening so quick that I just didnt see it but that doesnt seem to be the case. </p>

<p>Any help greatly appreciated.</p>

<pre><code>    function sleep(milliSeconds){
    var startTime = new Date().getTime(); // get the current time
    while (new Date().getTime() &lt; startTime + milliSeconds); // hog cpu
}

function UpdateConfig(some_id) {
    /* loop through all divs of class .changed_dropdown and if visible do something */
    $(".changed_dropdown").each(function(index) {
        if($(this).is(":visible")){ 

            some_id = ($(this).data('some_id'));
            /* turn off the div that shows this is in need of update (uparrow gif) */
            $('#changed'+some_id).toggle(false);
            /* turn on the div that displays the arrows going around in a circle (roundarrow gif) */
            $('#updating'+some_id).toggle(true);

            /* pause to allow the divs to change */
            sleep(500);
            var new_config = $("#" + some_id).val();
            $.post("change_config.php?some_id="+some_id+"&amp;config="+new_config);

            /* turn off the div that displays the arrows going around in a circle (roundarrow gif) */
            $('#updating'+some_id).toggle(false);
            /* turn on the gif that indicates this is the current setting */
            $('#unchanged'+some_id).toggle(true);

        }
    }); 
}
</code></pre>
