David .Wu 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?
?>
json_decode()
--
Donny Kurnia
http://blog.abifathir.com
http://hantulab.blogspot.com
http://www.plurk.com/user/donnykurnia