I need to get latitude and longitude from an address, using google maps, and manipulate it with php.
I'm using a code like this one https://developers.google.com/maps/documentation/javascript/examples/geocoding-simple, that has this part:
function codeAddress() {
var address = document.getElementById('address').value;
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var latitude = results[0].geometry.location.lat();
var longitude = results[0].geometry.location.lng();
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
} else {
alert('Geocode was not successful for the following reason: ' + status);
}
});
}
where I already added the variables latitude and longitude (following the instructions found in this question. Now, I need to use the variables I'd created inside the java script in a php script.
I'm newbie to javascript, so, I'm sorry if this is a simple question.