I'm using the following code in a php file
<script>
var geocoder = new google.maps.Geocoder();
geocoder.geocode( {'address': '<?php echo $element['singleCoords']; ?>' },
function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
firstLoc = results[0].geometry.location;
var gmap<?php echo $element['id']; ?>_marker = new google.maps.Marker({
position: new google.maps.LatLng(firstLoc)
When I alert firstLoc the long and lat are displayed like: 5.34.., 5,6...
But when I used the variable firstLoc in the function google.maps.LatLng() I can see in the code explorer of Chrome that only the variable name is passed and not the long and lat numbers.
In the code explorer I see this:
new google.maps.LatLng(firstLoc)
but I want to see this:
new google.maps.LatLng(5.34.., 5,6...).
What am I doing wrong?