Jquery serialize () to submit multiple forms of data

ajax submit multiple forms of data:

Forms respectively different first serialize () function, then the data serialized by stitching + submitted to the background, the following specific examples

var data1 = $('#form1).serialize();

var data2 = $('#form2).serialize();

$.ajax({
     url: url,
     type: 'POST',
     dataType: 'json',
     data: data1+data2,
    success: function (result) {

    },
    error : function() {

   }
});

Background Thinkphp5 receive data:

$data = input('post.','');

Guess you like

Origin www.cnblogs.com/wheats/p/11209374.html