php+js将复杂form表单序列化

博天堂足彩网官网

2018-11-08

表单html代码formclass=form-horizontalrole=formid=myformaction=method=postdivclass=form-grouplabelfor=emailclass=col-sm-2control-labelEmail/labeldivclass=col-sm-10inputtype=emailclass=form-controlid=emailname=user[email]placeholder=Emailvalue=/div/divdivclass=form-grouplabelfor=emailclass=col-sm-2control-label自我评价/labeldivclass=col-sm-10textareaclass=form-controlname=user[intro]rows=3/textarea/div/divdivclass=form-groupdivclass=col-sm-offset-2col-sm-10buttontype=submitclass=btnbtn-defaultid=subbtn提交/button/div/div/form把每个表单元素定义为如name=user[email]数组的格式,这样方便表单的值序列化$(function(){$(document).on(click,#subbtn,function(event){();varjson_data=$(#myform).serializeJSON();$.post(,json_data,function(data){(data);});});});。