JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDxMWxfA78E7mePkVLNM7B4578mJ7LL6co"></script>
JavaScript
var address = "magazine road ashford kent";
GetLocation(address, function (coord) {
var lat = coord.lat,
lng = coord.lng;
});
function GetLocation(address, callback) {
var geocoder = new google.maps.Geocoder();
geocoder.geocode({
'address': address
}, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
callback(results[0].geometry.location);
} else {
callback();
}
})
};