jQuery submit ajax form with 2 submit buttons
<p>im trying to achieve the following, in php i have a form like this:</p>

<pre><code>&lt;form method="post"  id="form_1" action="php.php"&gt;
&lt;input type="submit" value="add" name="sub"/&gt;
&lt;input type="submit" value="envoi" name="sub"/&gt;
&lt;/form&gt;
</code></pre>

<p>the form action file is:</p>

<pre><code>&lt;?php

if( $_POST["sub"]=="add"){  ?&gt;

 &lt;script&gt;
 alert("")
 &lt;/script&gt;
&lt;?php  echo "ZZZZZZ";   ?&gt;

&lt;?php } ?&gt;
</code></pre>

<p>so this means if i press sub with value add an alert prompt will come up, how can i do the same thing(differentiate both submit) but using a Ajax request:</p>

<p>the following code so does not work:</p>

<pre><code> $(function(){
      $('form#form_1').submit(function(){
var _data= $(this).serialize()
$.ajax({
        type: 'POST',
        url: "php.php?",
        data:_data,
        success: function(html){
         $('div#1').html(html)

          }
     })
})
  })
  &lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;div id="1" style="width: 100px;height: 100px;border: 1px solid red"&gt;&lt;/div&gt;

&lt;form method="post"  id="form_1" action="javascript:;"&gt;
&lt;input type="submit" value="add" name="sub"/&gt;
&lt;input type="submit" value="envoi" name="sub"/&gt;
&lt;/form&gt;
&lt;/body&gt;
</code></pre>
