Join GitHub today
Include array indexes in $.param() #749
#208 rewrote support for key support inside $.param(), but it doesn't work if you have objects inside arrays:
Consider the case of:
It is ambiguous whether the var[b] belongs to the [a] object, the [c] object or is an object on its own. PHP at least treats it as a totally new object which means it is impossible to have an array with objects with multiple values. jQuery gets around this by always including the array index, so the above example would become (assuming the [b] belonged to the same object as the [a]):
Attached patch adds the array index back in & updates test cases. traditional argument passing doesn't change, as mentioned in #208 it can't handle nested items anyway.
Have updated and added a new test case based on http://jsfiddle.net/DQD3c/4/ (was able to pass the original test cases when I still had code that wasn't consistent with jquery)
In the situation of x : [ [ [ 5 ] ] ](ie if the tree contains only scalars or arrays with 1 element) you could theoretically generate x=5 but jquery doesn't go in for the extra complexity of doing that so I didn't even try.