I have this JavaScript code that takes the location of the person and sends pro id="demo". How do I get the contents of the div with id="demo" and play in a php variable?
var x = document.getElementById("demo");
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = "";
}
}
function showPosition(position) {
x.innerHTML = "?pos=" + position.coords.latitude + ";" + position.coords.longitude;
}
window.onload = getLocation();
window.onload = showPosition();
Thank you in advance: D