title: jquery to create array from form data
body: <p>I've been wrestling with this problem for a couple hours now. </p>
  
  <p>Essentially, what I need to do is take the following or similar HTML:</p>
  
  <pre><code>&lt;div id="excpdivs"&gt;
  &lt;div class="excpdiv" id="excpdiv0"&gt;
        Date: &lt;input name="excp[0][date]"&gt;
        Open:  &lt;input name="excp[0][open]"&gt;
        Close: &lt;input name="excp[0][close]"&gt;
  &lt;/div&gt;
  &lt;div class="excpdiv" id="expdiv1"&gt;
        Date: &lt;input name="excp[1][date]"&gt;
        Open:  &lt;input name="excp[1][open]"&gt;
        Close: &lt;input name="excp[1][close]"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>and get an array similar to the following to a php script via AJAX:</p>
  
  <pre><code>   Array
  (
      [0] =&gt; Array
          (
              [date] =&gt; 2012-09-15
              [open] =&gt; 3:00
              [close] =&gt; 5:00
          )
     [1] =&gt; Array
          (
              [date] =&gt; 2012-09-16
              [open] =&gt; 2:00
              [close] =&gt; 5:00
          )
  
  )
  </code></pre>
  
  <p>My main problem is getting the values from the input elements. My latest attempt is the following:</p>
  
  <pre><code>    var results = [];
  $(".excpdiv").each(function(){
      var item = {};
      var inpts = $(this).find("input");
      item.date = $(inpts.get(0)).val();
      item.open = $(inpts.get(1)).val();
      item.close = $(inpts.get(2)).val();
      results.push(item);
  });
  </code></pre>
  
  <p>Am I on the right track or am I hopelessly lost?</p>