4
I’m with this script that brings user geolocation:
(function() {
if(!!navigator.geolocation) {
	var map;
	var mapOptions = {
	};
	
	map = new google.maps.Map(document.getElementById('google_canvas'), mapOptions);
	navigator.geolocation.getCurrentPosition(function(position) 
	{		
		var geolocate = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
		var php_latitude = position.coords.latitude;
		var php_longitude = position.coords.longitude;
		alert(php_latitude);
	});
	
} else {
	document.getElementById('google_canvas').innerHTML = 'No Geolocation Support.';
}
})();<script src="//maps.googleapis.com/maps/api/js?v=3.exp&key=XXX"></script>I need to pass latitude and longitude values to variables in PHP.
I tried to make:
<?php 
  $variavelphp = "<script>document.write(php_latitude)</script>";
  echo "Olá $variavelphp";
?>
But it didn’t work.
You can pass Jquery values to PHP?