jquery passing an array to html form -
i have 2 dimensional array:
if 'alert' output follows see expected results:
alert(myarray[0][0]['test']);
i passing array html form:
$('form#id1 #passarray').val(myarray);
i lisening form submission , if this:
var received=$('input#passarray').val(); alert(received[0][0]['test']);
i output: undefined.
is necessary prepare array in way if passing html form?
iirc, form input can have string value.
you either
- serialize array string $.param()
- iterate on array assign values individual form fields. form fields can have same name
[]
appended end treat them array, i.e.<input name="array[]" />
- just post array ajax
Comments
Post a Comment