I know, there are plenty of questions out there, but none of them worked for me.
I build an array with normal javascript objects in javascript and sent it via jquery.post
to the server. However on the server, I can't access the data using php $obj->value
. I tried json_decode/encode
and so on.
This is what console.log(data)
gives me, before sending it to the server.
Than on the php part I only do this:
$data= $_POST['data'];
print_r($data);
The output of print_r is:
And thats how my Jquery post looks like:
$.post("programm_eintragen.php",{
data: data,
}).success(
function(data){
//success
}).error(
function(){
console.log("Error post ajax " );
},'json');
Could somebody tell me:
how I can access my object properties on the php site properly?
I also get tried to access non object ....
or php interprets the json object as a string an data[0]
returns me [
.
I thought, I could do it like this:
$data[0]->uebungen[0]
Am I just being silly and missing something?
Why is this whole json sending to php thing such a problem?