title: how to select form id with jquery before sending out a form
body: <p>I have several forms on my page with different IDs. Each form has a submit button and should be handled separately.</p>
  
  <p>So the if i specify the form id the code below works fine, since I have x amount of forms which are not known in advance I need to make this script more general.</p>
  
  <pre><code>$(function() {
    $('#form1').on('submit', function() {
      $.ajax({
        type: 'post',
        url: 'post.php',
        dataType: 'json',
        data: $('#form1').serialize(),
        success: function() {
          console.log($('#form1').serialize());
        }
      });
    });
  });
  </code></pre>
  
  <p>I am able to get the form id with the scrpt below, but I cannot figure out how to combine with the script above.</p>
  
  <pre><code>$("form").submit(function() {
    var myId = this.id;
    alert(myId);
  });
  </code></pre>