How to send JSON object using JQUERY to PHP?

After struggling for hours and googling more, finally i succeeded in commincating over Json object. I will share the code:

JS side:

var datastring=JSON.stringify(obj);
$.post('getmessage.php',{data:datastring},function(res){
alert("HIIII"+res);
},"text");
});


php side:

$data=json_decode(stripslashes($_REQUEST['data']),true);
echo $data['page'];
?>

Comments

Popular posts from this blog

Most expensive product on Amazon India By Category

8 Product Management lessons from the movie 'Gold'