- 在项目中js的运行代码中再加一行方法
- //定义serializeObject方法,序列化表单
- <span style="white-space:pre;"> </span>$.fn.serializeObject = function() {
- <span style="white-space:pre;"> </span>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;
- };
js报serializeObject的错误信息
最新推荐文章于 2024-08-31 07:38:34 发布