I’m trying to get the contents of the returned php page, as follows:
(<?php echo json_encode(array("color"=>"Red")); ?>)
My JavaScript:
<script>
;
$.get("page.php",
function(data){
$('body').append("Color: " + data.color)
}, "json");
;
</script>
My page.php:
<?php echo json_encode(array("color"=>"Red")); ?>
How to make it work?
Try this