网络编程 
首页 > 网络编程 > 浏览文章

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

(编辑:jimmy 日期: 2026/5/4 浏览:3 次 )

复制代码 代码如下:
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;
}

上一篇:解析Javascript中中括号“[]”的多义性
下一篇:jQuery获得内容和属性方法及示例