title: Why is jquery-ajax submitting form multiple times?
body: <p>I have read this: <a href="https://stackoverflow.com/questions/11025185/jquery-ajax-form-submitting-multiple-times">jQuery ajax form submitting multiple times</a></p>
  
  <p>It didn't help.</p>
  
  <p>If i type something on form and click the submit button then it sends one request. Second time if i type something and click it sends two requests. Third time it sends three requests and so on. Why is this? Did i do any mistake in jquery code?</p>
  
  <p>Here is my code:</p>
  
  <p>index.php =></p>
  
  <pre><code>&lt;div id="id_div_1" class="cl_div_comment_container"&gt;&lt;/div&gt;
  &lt;form id="id_form_1" method="POST"&gt;
  &lt;input type="hidden" value="1" name="nm_hidden_post_id"&gt;
  &lt;textarea class="cl_textarea_comment" style="resize:none;" rows="1" cols="50" name="nm_comment_content"&gt;&lt;/textarea&gt;
  &lt;input class="cl_submit_comment" type="submit" value="Comment" name="nm_submit_comment"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>javascript.js =></p>
  
  <pre><code>$(document).ready(function(){
      console.log('hello');
      $('input[name="nm_submit_comment"]').on('click',function(){
          var frm = $(this).closest("form")[0];
          var frm_id = $(frm).attr("id");
          var frm_id_splitted = frm_id.split("_");
          var frm_id_splitted_2 = frm_id_splitted[2];
          console.log($('div#id_div_' + frm_id_splitted_2));
          $(frm).on('submit',function(e){
              e.preventDefault();
              frm_serialized = $(this).serialize();
              console.log(frm_serialized);
  
              $.ajax({
                  url: "save-comment.php",
                  method: "POST",
                  data: frm_serialized,
                  success: function(data) {
                      console.log(data);
                      $('div#id_div_' + frm_id_splitted_2).append(data);
                  }
              });
  
          });
  
      });
  
  });
  </code></pre>
  
  <p>save-comment.php =></p>
  
  <pre><code>&lt;?php
  
  if (session_id() == '') {
      session_start();
  }    
  
  echo json_encode($_POST);
  ?&gt;
  </code></pre>