Reputation: 2551
I have a two dimensional array:
If I 'alert' the output as follows I see expected results:
alert(myArray[0][0]['test']);
I am then passing the array to an html form:
$('form#id1 #PassArray').val(myArray);
I am then lisening for the form submission and if I do this:
var received=$('input#PassArray').val();
alert(received[0][0]['test']);
I get output: undefined.
Is it necessary to prepare the array in some way if passing it to a html form?
Upvotes: 0
Views: 1484
Reputation: 2527
IIRC, a form input can only have a string for its value.
You could either
[]
appended to the end to treat them as an array, i.e. <input name="array[]" />
Upvotes: 1