On a page called test.html I want to retrieve some JSON data from a page called test2.php by jquery ajax.
the following code does not work
test.html:
$.ajax({
url:"test2.php",
type:"POST",
dataType: "json",
success: function(data){
alert(data.b.d);
}
});
test2.php:
<?php
$c= '{"a":{"d":6994,"e":20003,"f":7968,"g":12505,"h":6814},"b":{"d":10623,"e":3404,"f":405,"g":17066,"h":24219}}';
echo $c;
?>