Wednesday, December 23, 2009

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'];
?>

No comments:

Post a Comment

Building Successful Products in the Maze of a Large Organization

  *Image is generated using AI Large organizations offer a treasure trove of resources and stability for product development. However, navig...