How to nest loops to cycle through indexed array inside of associative array (JS)
<p>I've got an indexed array of urls nested inside of another array that uses strings as its keys. I need to extract information from both arrays and I'm using the following loops.</p>

<pre><code>    // Loop through the elements in the associative level to get a count of its items   
    var keyCnt = 0;
    for(key in serviceCategories) {
        keyCnt++;
    }
    // Then loop through it again, this time nesting another for loop to get at the inner/indexed arrays
    for(key in serviceCategories) {
        var currCat = key;
            for (var i = 0; i &lt; keyCnt; i++) {
                $.ajax({
                    url: serviceCategories[currCat][i],
                    success: function(data) {
                        parsePageCont (data, currCat);
                    }
                });    
            }
        }
    }
</code></pre>

<p>This code works ok for the first element of the first array. It cycles through its inner array and excecutes the ajax call for every url with no problem. But then, when it finishes with the first element of the first array it doesn't proceed to the second one and fetch IT'S inner array data.</p>

<p>I hope that explanation wasnt too messed up. </p>

<p>You can see the full code here for more clarity: <a href="http://jsfiddle.net/FvP5f/" rel="nofollow">http://jsfiddle.net/FvP5f/</a></p>
