来自不同div容器中两个表单的PHP post(由ajax生成)
我有两个div容器,它们通过ajax更新两个不同的表单。是否可以使用ajax序列化两个表单中的数据?因此,我可以使用这两个表单的输入作为php中的POST 如果两个表单在同一个div中,我可以这样做,但在这种情况下我不能,对吗来自不同div容器中两个表单的PHP post(由ajax生成),php,jquery,ajax,Php,Jquery,Ajax,我有两个div容器,它们通过ajax更新两个不同的表单。是否可以使用ajax序列化两个表单中的数据?因此,我可以使用这两个表单的输入作为php中的POST 如果两个表单在同一个div中,我可以这样做,但在这种情况下我不能,对吗 $.ajax({ type:'POST', url: 'calculate.php', data:$('#form1, #form2').serialize(), success: function(response) {
$.ajax({
type:'POST',
url: 'calculate.php',
data:$('#form1, #form2').serialize(),
success: function(response) {
$('#results').html(response).slideDown();
}
$.ajax({
type:'POST',
url: 'calculate.php',
data:$('#form1').serialize() + '&' +$('#form2').serialize(),
success: function(response) {
$('#results').html(response).slideDown();
}