当前位置:Gxlcms > JavaScript > 将form表单中的元素转换成对象的方法适用表单提交

将form表单中的元素转换成对象的方法适用表单提交

时间:2021-07-01 10:21:17 帮助过:11人阅读

代码如下:


function serializeObject(form){
var o ={};
$.each(form.serializeArray(),function(index){
if(o[this['name']]){
o[this['name']] = o[this['name']] +","+this['value'];
}else{
o[this['name']] = this['value'];
}
});
return o;
}

人气教程排行