I have a javascript object which I am encoding to Json and sending data to PHP. Unfortunately, PHP can't decode JSON string to array. I am lost at this point.
Jquery
sendData = {city: 48, fullName: 'John'};
sendData = JSON.stringify(sendData);
$.get("ajax/getter.php", { get: "info", data: sendData },function(data){
// DO STH with returned data
});
OUTPUT : {"city":48,"fullName":"John"}
PHP part
<?php
$data = $_GET['data'];
$data = json_decode($data);
var_dump($data);
?>
OUTPUT : NULL
I will be glad if anyone could show me where I am doing wrong.