I\'ve read a few questions about the subject here on but couldn\'t find the answer I\'m looking for. I\'m doing some $.post with jQuery to a PHP5.6 server.
$
In order to send raw json data, you have to stop jQuery from url-encoding it:
data = {"a":"test", "b":{"c":123}};
$.ajax({
type: 'POST',
url: '...',
data: JSON.stringify(data), // I encode it myself
processData: false // please, jQuery, don't bother
});
On the php side, just read php://input and json_decode it:
$req = file_get_contents("php://input");
$req = json_decode($req);