相同name值会转化为一个数组

$.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;
};

jquery的序列化表单只能序列化成一个对象 , 但是接口接收的Array咋办呢? 请粘贴上面代码

相关文章:

  • 2022-12-23
  • 2021-12-13
  • 2021-12-13
  • 2021-12-13
  • 2021-09-05
  • 2021-08-02
猜你喜欢
  • 2021-08-24
  • 2019-11-11
  • 2021-12-13
  • 2021-09-03
相关资源
相似解决方案