Parsing multidimensional array input from html to php via jquery ajax -


i have problem sending html inputs php via ajax..i have multiple input fields so:

<input type="text" name="fields[]['name']" > 

then send php via jquery ajax so: $.post('test.php',$('#form').serialize,function(data){alert(data)});

in test php print fields print_r($_post['fields']).

i hoping key=>value multidimensional array instead array so:

array (     [0] => array         (             [0] => 102         )      [1] => array         (             [0] => seo offsite         )      [2] => array         (             [0] => 0         ) 

what problem ? how can values like:

array (     [0] => array         (             ['id'] => 102         )      [1] => array         (             ['name'] => seo offsite         )      [2] => array         (             ['code'] => 0         ) 

in earlier developments solved topic managing field index in client side example.

<input type="text" name="fields[0]['name']" > <input type="text" name="fields[0]['id']" >   <input type="text" name="fields[1]['name']" > <input type="text" name="fields[1]['id']" > ... 

and use .serializearray() instead .serialize


Comments