Actually I want need server side doing work, and I don't know how php get json, nothing to do with client side.
On 6月12日, 下午4時55分, Anish <cani...@gmail.com> wrote: > What you get while trying $json['name'] ?? > > Why don't you try getJSON instead of calling usual ajax call ?? > > Regards, > > Anish** > > On Jun 11, 4:40 pm, "David .Wu" <chan1...@gmail.com> wrote: > > > If I send a json format to php, how to get the value from php? for > > example > > > front page > > <script> > > var jsonStr = '{"name": "David", "age", "23"}'; > > $.ajax({ > > url: 'json.php', > > type: 'POST', > > cache: false, > > data: {json: jsonStr}, > > success: function(data) { > > alert(data); > > }}); > > > </script> > > > php page > > <?php > > $json = $_POST['json']; > > > // it's get {"name":"David","age": "23"}, but how to gete name? > > ?>