jquery form表单序列化为对象

来源:互联网 发布:网络文摘 1997- 编辑:程序博客网 时间:2024/05/17 22:57
$.fn.serializeObject = function() {    var o = {};    var a = this.serializeArray();    $.each(a, function() {        if (o[this.name]) {            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 0
原创粉丝点击