Permalink
Browse files

fix serializeObject method to remove [] from field name

  • Loading branch information...
1 parent b998d4d commit 17c273c406e4279a5a708994fafc681a00faebe6 @alextk committed Mar 20, 2012
Showing with 28 additions and 24 deletions.
  1. +10 −8 dist/jquery.jqext.js
  2. +3 −3 dist/jquery.jqext.min.js
  3. +3 −3 dist/jquery.jqext.pack.js
  4. +2 −2 license.txt
  5. +8 −6 src/wrapped-set/serialize.js
  6. +2 −2 version.yml
View
@@ -2,14 +2,14 @@
* jqExt - jQuery extensions and native javascript extensions
*
* Version: 0.0.1
-* Build: 7
+* Build: 8
* Copyright 2011 Alex Tkachev
*
* Dual licensed under MIT or GPLv2 licenses
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
-* Date: 19 Dec 2011 16:37:39
+* Date: 20 Mar 2012 19:13:19
*/
/**
@@ -1614,22 +1614,24 @@ jQuery.ext.Extender.addWrapedSetMethods({
objectData = {};
$.each(arrayData, function() {
- var value;
+ var value, name;
+
+ name = this.name.replace('[]', '');
if (this.value != null) {
value = this.value;
} else {
value = '';
}
- if (objectData[this.name] != null) {
- if (!objectData[this.name].push) {
- objectData[this.name] = [objectData[this.name]];
+ if (objectData[name] != null) {
+ if (!objectData[name].push) {
+ objectData[name] = [objectData[name]];
}
- objectData[this.name].push(value);
+ objectData[name].push(value);
} else {
- objectData[this.name] = value;
+ objectData[name] = value;
}
});
View

Large diffs are not rendered by default.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -2,13 +2,13 @@
* jqExt - jQuery extensions and native javascript extensions
*
* Version: 0.0.1
-* Build: 7
+* Build: 8
* Copyright 2011 Alex Tkachev
*
* Dual licensed under MIT or GPLv2 licenses
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
-* Date: 19 Dec 2011 16:37:39
+* Date: 20 Mar 2012 19:13:19
*/
Oops, something went wrong.

0 comments on commit 17c273c

Please sign in to comment.