I have an array or a javascript object that I create like this:
arr[arr.length]=obj
where the obj is a classic JSON string like {\"id\":1}
.
Can send the JSON and use json_decode()
to turn it into a php array.
$.post('server/path', { jsonData: JSON.stringify(arr)}, function(response){
/* do something with response if needed*/
});
in php:
$arr=json_decode( $_POST['jsonData'] );
/* return first ID as test*/
echo $arr[0]['id'];
/* or dump whole array as response to ajax:*/
print_r($arr);