This is what I am trying to accomplish (the accepted answer).
var locations = [
['Bondi Beach', -33.890542, 151.274856, 4],
['Coogee Beach', -33.923036, 151.259052, 5],
['Cronulla Beach', -34.028249, 151.157507, 3],
['Manly Beach', -33.80010128657071, 151.28747820854187, 2],
['Maroubra Beach', -33.950198, 151.259302, 1]
];
The difference is the values are stored in an array. I tried this:
<?foreach($nearest_hospitals as $item):?>
var locations = [
[<?$item->H_NAME;?>, <?$item->H_LAT;?>, <?$item->H_LONG;?>, <?$item->H_ID;?>],
];
<?endforeach?>
With this, the map is not showing. Please help me. Thank you!