0
点赞
收藏
分享

微信扫一扫

jquery读取表单数据: serializeArray & serializeObject


$.fn.serializeObject = function()
{
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
o[this.name] = this.value || '';
}
});
return o;
};

举报

相关推荐

0 条评论