[JavaScript] jquery序列化对象为json格式 →→→→→进入此内容的聊天室

来自 , 2019-06-12, 写在 JavaScript, 查看 105 次.
URL http://www.code666.cn/view/1d0932d7
  1. $.fn.serializeObject = function()
  2. {
  3.    var o = {};
  4.    var a = this.serializeArray();
  5.    $.each(a, function() {
  6.        if (o[this.name]) {
  7.            if (!o[this.name].push) {
  8.                o[this.name] = [o[this.name]];
  9.            }
  10.            o[this.name].push(this.value || '');
  11.        } else {
  12.            o[this.name] = this.value || '';
  13.        }
  14.    });
  15.    return o;
  16. };
  17. //javascript/4300

回复 "jquery序列化对象为json格式"

这儿你可以回复上面这条便签

captcha