jq中提交表单转为json

来源:互联网 发布:网络理财排行榜 编辑:程序博客网 时间:2024/06/05 10:15
$.fn.serializeJSON = 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;};
原创粉丝点击