title: to submit a form among multiple forms using jquery-ajax
body: <p>i have multiple forms with same class name</p>
  
  <pre><code>&lt;form &gt;
    &lt;input type="hidden" value="&lt;%=ids%&gt;" name="idd"&gt;
    &lt;input type="hidden" value="&lt;%=email%&gt;" name="cby"&gt;
    &lt;input type="text" class="cmd" name="cm" style="width:300px;" placeholder="comment"&gt;
    &lt;input type="submit" value="" style="display:none;"&gt;
  &lt;/form&gt;
    &lt;!-- n number of forms are  generated using while loop--&gt;
  &lt;form&gt;
    &lt;input type="hidden" value="&lt;%=ids%&gt;" name="idd"&gt;
    &lt;input type="hidden" value="&lt;%=email%&gt;" name="cby"&gt;
    &lt;input type="text" class="cmd" name="cm" style="width:300px;" placeholder="comment"&gt;
    &lt;input type="submit" value="" style="display:none;"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Then how can i submit a single form among this n number of forms i tried using</p>
  
  <pre><code>   $(function () {
            $('form').on('submit', function (e) {
                  $.ajax({
                   type: 'post',
                    url: 'addfr.jsp',
                    data: $('form').serialize(),
                    success: function () {
                    location.reload();
  
                    }
            });
           e.preventDefault();
       });
    });
  </code></pre>
  
  <p>But it is submitting always 1st form among the n-forms.
  How can submit a random form among the n-forms.
  May any one help me please.</p>