Passing array of arrays via Ajax -


i'm trying pass array of arrays via ajax call php script.

var myarray=$('input#thisisanarray').val();  var datastring='passedarray='+myarray;  $.ajax({      type: "post",      datatype: "json",      url: "includes/myphp.php",      data: datastring,      success:function(){                  }  }); 

then in php.php:

print_r($_post['passedarray'][0][0]); 

i retarded message:

 fatal error: cannot use string offset array 

which makes no sense because using integers access array not string.

the json object structure is:

0>  0>   admin_id: 1   status: 1   date: 1366300373   outcome_id: 1   rank: 1  1>   admin_id: 2   status: 2   date: 1366300373   outcome_id: 5   rank: 6 

thanks in advance.

remember datatype in jquery.ajax() expected response http call. want here specify contenttype.

more information here.

also, not know how php parses data send, make sure = works here.

edit: please explain me numbers 0>, , 1> mean? because far know json not @ all.

an array in json written way:

[     "first value": 1,     "second value": "a string",     "and on": 500,     "note last key not need comma",     "and key not need have value assigned it" ] 

an array of arrays written way:

[     ["key": "value in array contained in array"],     ["second array here"],     ["and last array, without comma"] ] 

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 -