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

  1. serialize array string $.param()
  2. iterate on array assign values individual form fields. form fields can have same name [] appended end treat them array, i.e. <input name="array[]" />
  3. just post array ajax

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -