jquery将一个表单序列化为一个对象的方法

内容摘要
复制代码 代码如下: var aa=function(form){ var o={}; $.each(form.serializeArray(),function(index){ if(o[this['name']]){ o[this['name']] = o[this['name']]+","+thi
文章正文

复制代码 代码如下:

var aa=function(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;
}


代码注释

作者:喵哥笔记

IDC笔记

学的不仅是技术,更是梦想!