Ajax POST multiple forms with multiple PHP destinations <p>I have a page with two forms and each form uses a different PHP page for its post. I can only find examples / documentation on using multiple forms with the same PHP post script. I am struggling to get this to work, can any help ? </p> <p>This is the JQUERY, that works if i use one form, I've tried to add an ID tag but it didn't seem to work:</p> <pre><code> $(function () { $('form').on('submit', function (e) { var form = $(this); e.preventDefault(); $.ajax({ type: 'post', url: form.attr('action'), data: form.serialize(), success: function () { alert('Suppiler Amended!'); } }); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;?php echo "&lt;div class='table1'&gt;"; echo "&lt;div class='datagrid'&gt;"; echo "&lt;table id='tblData2'&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Notes&lt;/th&gt;&lt;th&gt;Updated By&lt;/th&gt;&lt;th&gt;&lt;/th&gt;&lt;/thead&gt;&lt;/tr&gt;"; while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC)) { ?&gt; &lt;tbody&gt;&lt;tr&gt; &lt;td&gt;&lt;FONT COLOR='#000'&gt;&lt;b&gt;&lt;?php echo "".$row["notes"].""?&gt;&lt;/td&gt; &lt;td&gt;&lt;FONT COLOR='#000'&gt;&lt;b&gt;&lt;?php echo "".$row["enteredby"].""?&gt;&lt;/td&gt; &lt;td&gt;&lt;FONT COLOR='#000'&gt;&lt;b&gt;&lt;a href="edit.php"&gt; &lt;form name="edit" action="script1.php" method="post"&gt; &lt;input type="hidden" name="notes" value="&lt;?php echo"".$row["notes"]."";?&gt;"&gt; &lt;input type="hidden" name="noteid" value="&lt;?php echo"".$row["noteid"]."";?&gt;"&gt; &lt;input type="submit" value="EDIT"&gt; &lt;/form&gt; &lt;/a&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt; &lt;?php $companyid = "".$row['id'].""; } ?&gt; &lt;/table&gt; &lt;/div&gt; &lt;br&gt; &lt;form name="notes" action="add-note.php" method="post"&gt; ADD NEW NOTE:&lt;br&gt; &lt;input type="text" name="newnote" style="height:120px;width:200px;"&gt;&lt;br&gt; &lt;input type="hidden" name="companyid" value="&lt;?php echo"".$companyid."";?&gt;"&gt; &lt;input type="hidden" name="user" value="&lt;?php echo"".$user."";?&gt;"&gt; &lt;br&gt; &lt;input type="submit" value="ADD NOTE"&gt; &lt;/form&gt; </code></pre>