title: create dynamic formdata in jQuery
body: <p>I have a form from there i want to send form data to the server side .But i am not able to create dynamic query string in jquery .I have a html like this :</p>
  
  <pre><code>&lt;div&gt;
      &lt;ul class="items" id ="test"&gt;
          &lt;li class="test" id="11" attr ="11"&gt;&lt;/li&gt;
          &lt;li class="test" id="12" attr ="12"&gt;&lt;/li&gt;
          &lt;li class="test" id="13" attr ="13"&gt;&lt;/li&gt;
          &lt;li class="test" id="14" attr ="14"&gt;&lt;/li&gt;
  
      &lt;/ul&gt;
      &lt;ul class="items" id ="test1"&gt;
          &lt;li class="test" id="21" attr ="21"&gt;&lt;/li&gt;
          &lt;li class="test" id="22" attr ="22"&gt;&lt;/li&gt;
          &lt;li class="test" id="23" attr ="23"&gt;&lt;/li&gt;
          &lt;li class="test" id="24" attr ="24"&gt;&lt;/li&gt;
      &lt;/ul&gt;
       &lt;ul class="items" id ="test2"&gt;
          &lt;li class="test" id="31" attr ="31"&gt;&lt;/li&gt;
          &lt;li class="test" id="32" attr ="32"&gt;&lt;/li&gt;
          &lt;li class="test" id="33" attr ="33"&gt;&lt;/li&gt;
          &lt;li class="test" id="34" attr ="34"&gt;&lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I have done this in jQuery</p>
  
  <pre><code>var ids=[];
  $('ul.items').each(function(){
      var id = $(this).attr('id').replace(/test/,'');
      var tmp_arr=[];
      $($(this).find("li")).each(function(){
          var attr_val = $(this).attr("attr");
          tmp_arr.push({$(this).attr('id')});
      });
      ids.push(tmp_arr);
  });
  </code></pre>
  
  <p>But my desired jquerystring is like this</p>
  
  <pre><code>{
      "test"=&gt;{
          "ids"=&gt;['11','12','13','14'],
          "attr=&gt;['11','12','13','14']"
          },
      "test1"=&gt;{
          "ids"=&gt;['21','22','23','24'],
          "attr=&gt;['21','22','23','24']"
          },
      "test2"=&gt;{
          "ids"=&gt;['31','32','33','34'],
          "attr=&gt;['31','32','33','34']"
          }
  } 
  </code></pre>
  
  <p>How can we create this jQuery please help me</p>