title: Remove duplicate form inputs while serializing and submitting two or more forms
body: <p>I have two forms holding the common action with inputs with same names. First my requirement is to submit the individual forms which i can do easily. Then i need to submit both the forms at a time by serializing and sending through ajax. Here the problem is, as both the forms contains inputs with same names duplicate values are going through post. How can i prevent it?</p>
  
  <p>Ex:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function(){
  $("#btn").on("click",function(){
  var dataString=$('#form1, #form2').serialize();
  $.ajax({
              url: "someOther.jsp",
              dataType: 'json',
              data: dataString,
              success: function (data) {
                  console.log(data);
              },
              error: function (data) {
                  console.log(data);
              }
        });
  });
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;form action="some.jsp" method="post" id="form1"&gt;
  &lt;input type="hidden"  name="hField1" value="value1"&gt;
  &lt;input type="hidden"  name="hField2" value="value2"&gt;
  &lt;input type="text" id="field11" name="field11"&gt;
  &lt;input type="text" id="field21" name="field21"&gt;
  &lt;input type="submit" value="Save"&gt;
  &lt;/form&gt;
  
  &lt;form action="some.jsp" method="post" id="form2"&gt;
  &lt;input type="hidden"  name="hField1" value="value1"&gt;
  &lt;input type="hidden"  name="hField2" value="value2"&gt;
  &lt;input type="text" id="field12" name="field12"&gt;
  &lt;input type="text" id="field22" name="field22"&gt;
  &lt;input type="submit" value="Save"&gt;
  &lt;/form&gt;
  
  &lt;button id="btn"&gt;Submit&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>