Add elements to 2D array in jquery
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/966225/how-to-create-a-two-dimensional-array-in-javascript">How to create a two dimensional array in JavaScript?</a>  </p>
</blockquote>



<p>I want to push elements to 2D array, </p>

<p>My code is, </p>

<pre><code>        var results = [];
        var resultstemp = [];
        function bindlinks(aamt,id1) {
        resultstemp=results;        
            imagesArray.push($("#image1").mapster("get"));

            if(results.length==0)
            {
            results.push([id1]);    
            }
            else
            {
               var ck=0;
               var lng=results.length;
                for (var i = 0; i &lt; lng; i++) {

                  if(results[i]==id1)
                  {

                    ck=1;
                     results = jQuery.grep(results, function(value) {
                        return value != id1;
                      });

                  }                                     
                }                   
                if(ck==0)
                {
                results.push(id1);                  
                }                   
            }
</code></pre>

<p>I want to push <code>id</code> as well as <code>aamt</code> to array. Here i am pushing only id to array. I am not sure about how to add <code>aamt</code> to second position in 2D array.   </p>

<p>Help me please,</p>

<p>Thank you    </p>
