Sorry guys I'm a rookie on JS and I have the problem explained below: how do I pass the values of vars "lat1" and "long1" to outside the function and assign them to wp as shown?
(No problem with wp that I get from another file).
lat1 = pos.coords.longitude;
long1 = pos.coords.latitude;
var lat2 ="<?php echo $_SESSION['lat']; ?>";
var long2 ="<?php echo $_SESSION['long']; ?>";
var wp = new Array(2);
wp = lat1 + "," +long1;
wp = lat2 + "," +long2;
inicio = (wp);
destino = (wp);