in php
<?php
$arr = array ('a'=>1,'b'=>2,'c'=>3,'d'=>4,'e'=>5);
echo json_encode($arr); // {"a":1,"b":2,"c":3,"d":4,"e":5}
?>
in javascript,
$.getJSON('drivetracker2.php', function(data) {
console.log(data);
});
I am trying to access the php array which was sent via json to javascript.
but it says data is undefined.
anyone know why and how to fix this problem?