I return an array of array from php to json
here’s php array
$cities = array();
while($row = mysql_fetch_array($result)){
$cityRow= array('cityNo'=>$row['city_no'], 'cityName'=>$row['city_name']);
$cities[]=$cityRow;
}
echo json_encode($cities);
Here’s the json
$.getJSON("controllers/Customer.controller.php",param,function(result){
// what should I write here to reach the array elements??
});
You can iterate over the object using
.each: