title: Multi forms on one page using ajax handler not working
body: <p>I have two ajax forms on one page, the first one is set to hide after it has been submitted and this works perfectly, my problem is when I submit the second one with the presence of the 1st one it wouldn`t work (when I click the submit nothing happens) although it works when I submit it after the first when has been hidden..</p>
  
  <p>here are my two forms codes and the ajax handler</p>
  
  <pre><code>    &lt;!-- Form 1 --&gt;
      &lt;div class="panel-heading " role="tab"&gt;
      &lt;input type="submit" class="deep_blue" data-toggle="modal" data-target="#post_form" value="Add Origin Text"&gt;
      &lt;div class="modal fade" id="post_form" tabindex="-1" role="dialog" aria-labelledby="postModalLabel" aria-hidden="true"&gt;
        &lt;div class="modal-dialog"&gt;
          &lt;div class="modal-content"&gt;
            &lt;div class="modal-header"&gt;
              &lt;button type="button" class="close" data-dismiss="modal" aria-label="Close"&gt;
                &lt;span aria-hidden="true"&gt;
                  &amp;times;
                &lt;/span&gt;
              &lt;/button&gt;
              &lt;h4 class="modal-title" id="postModalLabel"&gt;
                &lt;p style="color: #580024; margin-bottom: 0px;"&gt;
                  &lt;b&gt;Add Origin Text
                  &lt;/b&gt;
                &lt;/p&gt;
              &lt;/h4&gt;
            &lt;/div&gt;
            &lt;div class="modal-body"&gt;
                 &lt;form action="" method="post" class="profile_post registration-form"&gt;
                                 &lt;fieldset&gt;
                        &lt;div class="form-bottom"&gt;
                          &lt;div class="form-group"&gt;
                            &lt;p style="color: #580024;"&gt;Poet&lt;/p&gt;
                          &lt;textarea  class="form-control  btn-" name="addorigin_epoet"&gt;&lt;?php echo $epoet_name ?&gt;&lt;/textarea&gt;&lt;br&gt;
                          &lt;p style="color: #580024;"&gt;Poem&lt;/p&gt;
                          &lt;textarea  class="form-control  btn-"  name="addorigin_epoem"&gt;&lt;?php echo $epoem_title ?&gt;&lt;/textarea&gt;&lt;br&gt;
                           &lt;p style="color: #580024;"&gt;Origin Title&lt;/p&gt;
                          &lt;textarea  class="form-control  btn-" placeholder="..." name="addorigin_otitle"&gt;&lt;/textarea&gt;&lt;br&gt;
  
                          &lt;p style="color: #580024;"&gt;Origin Body&lt;/p&gt;
                          &lt;textarea  class="form-control  btn-" placeholder="..." name="addorigin_origin"&gt;&lt;/textarea&gt;&lt;br&gt;
                          &lt;input type="hidden" name="user_from" value="&lt;?php echo $userLoggedIn; ?&gt;"&gt;
                          &lt;input type="hidden" name="addorigin_ie" value="&lt;?php echo $ie; ?&gt;"&gt;
  
                        &lt;/fieldset&gt;
  
                  &lt;/form&gt;
  
                       &lt;/div&gt;
            &lt;button type="button" class="btn btn-primary" name="post_button" id="submit_profile_post"&gt;&lt;p"&gt;Add&lt;/p&gt;
            &lt;/button&gt;
            &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Close
            &lt;/button&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;!-- Form 2 --&gt;
      &lt;div class="panel-heading " role="tab" id="headingError" &gt;
      &lt;input type="submit" class="deep_blue" data-toggle="modal" data-target="#post_form2" value="Submit Error"&gt;
      &lt;div class="modal fade" id="post_form2" tabindex="-1" role="dialog" aria-labelledby="postModalLabel2" aria-hidden="true"&gt;
        &lt;div class="modal-dialog"&gt;
          &lt;div class="modal-content"&gt;
            &lt;div class="modal-header"&gt;
              &lt;button type="button" class="close" data-dismiss="modal2" aria-label="Close"&gt;
                &lt;span aria-hidden="true"&gt;
                  &amp;times;
                &lt;/span&gt;
              &lt;/button&gt;
              &lt;h4 class="modal-title" id="postModalLabel2"&gt;
                &lt;p style="color: #580024; margin-bottom: 0px;"&gt;
                  &lt;b&gt;Submit Error
                  &lt;/b&gt;
                &lt;/p&gt;
              &lt;/h4&gt;
            &lt;/div&gt;
            &lt;div class="modal-body"&gt;
                 &lt;form id="error" action="" method="post" class="profile_post registration-form"&gt;
                                 &lt;fieldset&gt;
                        &lt;div class="form-bottom"&gt;
                          &lt;div class="form-group"&gt;
                            &lt;p style="color: #580024;"&gt;Poet&lt;/p&gt;
                          &lt;textarea  class="form-control  btn-" name="error1"&gt;&lt;?php echo $epoet_name ?&gt;&lt;/textarea&gt;&lt;br&gt;
                          &lt;p style="color: #580024;"&gt;Poem&lt;/p&gt;
                          &lt;textarea  class="form-control  btn-"  name="error2"&gt;&lt;?php echo $epoem_title ?&gt;&lt;/textarea&gt;&lt;br&gt;
                          &lt;p style="color: #580024;"&gt;Error&lt;/p&gt;
                          &lt;textarea  class="form-control  btn-" placeholder="Error" name="error3"&gt;&lt;/textarea&gt;&lt;br&gt;
                          &lt;input type="hidden" name="user_from" value="&lt;?php echo $userLoggedIn; ?&gt;"&gt;
  
  
  
            &lt;button type="button" class="btn btn-primary" name="post_button" id="submit_profile_post"&gt;&lt;p style="color: #580024; margin-bottom: 0px;"&gt;Submit&lt;/p&gt;
            &lt;/button&gt;
            &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Close
            &lt;/button&gt;      &lt;/fieldset&gt;
                  &lt;/form&gt;
  
                       &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;/div&gt;
  
  
  
      &lt;!-- ajax_submit_profile_post --&gt;
      if(isset($_POST['addorigin_origin'])) {
        $post = new Post($con, $_POST['user_from']);
        $post-&gt;submitPostAddorigin($_POST['addorigin_ie'],$_POST['addorigin_epoet'],$_POST['addorigin_epoem'],$_POST['addorigin_otitle'],$_POST['addorigin_origin']);
      }
  
  
      if(isset($_POST['error3'])) {
        $error = new Post($con, $_POST['user_from']);
        $error-&gt;submitPostError($_POST['error1'],$_POST['error2'],$_POST['error3']);
      }
  
  
  $(document).ready(function() {
  
  
  
  
  
  $('.button_holder').on('click', function() {
      document.search_form.submit();
  })
  
  //Button for profile post
  $('#submit_profile_post').click(function(){
  
      $.ajax({
          type: "POST",
          url: "includes/handlers/ajax_submit_profile_post.php",
          data: $('form.profile_post').serialize(),
          success: function(msg) {
              $("#post_form").modal('hide');
              location.reload();
          },
          error: function() {
              alert('Failure');
          }
      });
  
  });
  
  
  });
  </code></pre>