How come I can't lookup associated array like this?
<pre><code>urlMap = {
    '0': {'6b4247404960fd4e418d242f3b7f0412': 'http://google.com', '123':'http://ibm.com'},
    '1': {'4c27ffaef99b7a6dbe838b46bcc09779' : 'http://yahoo.com', '456':'http://abc.com'}

};

    $(function() {
     var l = new Array(1,2,3,4);
     for (var i = 0; i &lt; l.length; i++){
          $("#"+i.toString()+".foo").change(function() {
           g = i.toString();
               window.location.href = urlMap[g][$(this).val()];
    })}});
</code></pre>

<p>I tried to use urlMap[i] it won't work. When I hardcode urlMap['0'] it works.</p>

<p>From Firebug, I see this</p>

<pre><code>urlMap[g] is undefined
[Break On This Error]   

window.location.href = urlMap[g][$(this).val()];
</code></pre>

<p>How am I suppose to lookup the dictionary?</p>

<p>Thanks.</p>
