如何将jQuery序列化对象转换成JSON格式?
- 内容介绍
- 文章标签
- 相关推荐
本文共计87个文字,预计阅读时间需要1分钟。
javascript$.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;};
$.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; };
本文共计87个文字,预计阅读时间需要1分钟。
javascript$.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;};
$.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; };

