title: How to use multiple Submit buttons in a single form having Ajax
body: <p>I'm building a simple website which uses mysql as backend. I have a form which has 2 buttons of which one searches data from db and populates the page using Ajax another button updates the new values to db. Now my problem is i can't use both buttons as 'Submit' button.</p>
  
  <p>Ajax Method &amp; Html Form:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
       $(document).ready(function(){  
             $(document).on('submit', '#update-form', function(){
                  var data = $(this).serialize();
                  $.ajax({
                      type : 'POST',
                      url  : 'search.php',
                      data : data,
                      success :  function(data){
                          $(".display").html(data);
                      }
                  });
                  return false;
              });
          });
  &lt;/script&gt;
  &lt;body&gt;
    &lt;div id="update" class="tab-pane fade"&gt;
                  &lt;form id="update-form" role="form" class="container" method="post" action="search.php"&gt;
                      &lt;h3&gt;Update details&lt;/h3&gt;
                      &lt;table class="display"&gt;
                          &lt;tr  class="space"&gt;
                              &lt;td&gt;&lt;label&gt;File Number:&lt;/label&gt;&lt;/td&gt;
                              &lt;td&gt;&lt;input type="text" class="form-control" name="filenum" required&gt;&lt;/td&gt;
                          &lt;/tr&gt;
                      &lt;/table&gt;
                      &lt;button type="submit" class="btn btn-default text-center" name="search_btn" &gt;Search&lt;/button&gt;      
                      &lt;button type="submit" class="btn btn-default text-center"  name="submit_btn" formaction="update.php"&gt;Update&lt;/button&gt;
                  &lt;/form&gt;
              &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>Now i want to know how can i modify above code so that i can use both button as submit.</p>
  
  <p><b>Tried with</b><code>formaction</code> <b>but it doesn't work because of Ajax method usage.</b></p>