标签:object this 对象 serial lse turn ali form layui
//表单序列化成JSON对象
$.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;
}
//调用方式
var data = $(".layui-form").serializeObject();
data 就是JS对象了
标签:object this 对象 serial lse turn ali form layui
原文地址:https://www.cnblogs.com/kangyuanjiang/p/9902912.html