只需自定义函数并添加参数
formid即可在函数内获取表单数据以进行传递
processForm("id of the form");function processForm(formId) { //your validation pre $.ajax( { type: 'POST', url: form_process.php, data: $("#"+formId).serialize(), success: function(data) { $('#message').html(data); } } ); }<form action="" id="form1" method="post" onsubmit="processForm('form1');return false;"><input type='text' name='user_name' id='user_name' value='' /><input type='submit' name='submit' value='submit'/></form><form action="" id="form2" method="post" onsubmit="processForm('form2');return false;"><input type='text' name='user_name' id='user_name' value='' /><input type='submit' name='submit' value='submit'/></form><form action="" id="form3" method="post" onsubmit="processForm('form3');return false;"><input type='text' name='user_name' id='user_name' value='' /><input type='submit' name='submit' value='submit'/></form><div id='message'></div>


