Dear all i am using php and JQuery, and JSON.Now i need to know how to parseThe JQuery data in javascript.
load.php
<?php
...
$json =json_encode($array);
?>
It Returns jQuery by following data
[{"name":"STA","distance":"250","code":25},
{"name":"GIS","distance":"500","code":45}]
jQuery
$.getJSON("load.php", function(json){
// access object
var a=json;
pass(a);
});
Now I need Pass the a Json to javascript defined in my.js
var myjson={};
function pass(a){
myjson=a;
//Here How to get name,and distance,code
//I have Tried alert(myjson.name) returns undefined
}
Any one help me any changed to made in my logic?