title: JS associative array from form input field
body: <p>My form contains multiple input fields. For example:</p>
  
  <pre><code>&lt;input type="number" class="attribute-class form-control"  id="Size" min="1" max="99999" name="attribute[]"&gt;
  &lt;input type="number" class="attribute-class form-control"  id="weight" min="1" max="99999" name="attribute[]"&gt;
  </code></pre>
  
  <p>Now I want to create an array, something like this <code>array[size =&gt; 10, weight=&gt; 20]</code></p>
  
  <p>Is that even possible? 
  So far I used this function I found on another topic, but I get a regular array with just the fields value.</p>
  
  <pre><code>var attribute = $("input[name='attribute[]']").map(function(){
              return $(this).val();}).get(); 
  </code></pre>
  
  <p>Reason for this: I have to load additional input fields in my form with ajax, depending on what type of product the user selects, and then I have to store fields name and value in database. This is the only option I could think of.</p>