<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (p) {
var LatLng = new google.maps.LatLng(p.coords.latitude, p.coords.longitude);
var mapOptions = {
center: LatLng,
zoom: 13,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("dvMap"), mapOptions);
var marker = new google.maps.Marker({
position: LatLng,
map: map,
draggable: true,
title: "<div style = 'height:60px;width:200px'><b>Your location:</b><br />Latitude: " + p.coords.latitude + "<br />Longitude: " + p.coords.longitude
});
google.maps.event.addListener(marker, "click", function (e) {
var infoWindow = new google.maps.InfoWindow();
infoWindow.setContent(marker.title);
infoWindow.open(map, marker);
<?php $var ?>
var latitude = p.coords.latitude;
var longitude = p.coords.longitude;
“var latitude and var longitude”是我的变量,以获得当前的变量 lat-lng进入数据库的地图和商店的位置。这就是我的逻辑 好吗?如果没有,那么如何在我的地图上获取当前的lat-lng
});
});
} else {
alert('Geo Location feature is not supported in this browser.');
}
</script>
<div id="dvMap" style="width: 100%; height: 500px">
</div>
<div> <label style="position: absolute;top: 80%;" for="Drop-off" class="col-md-4 control-label">Drop-off</label>
<input id="Drop-off" type="text" class="form-control" name="Drop-off" value="{{ old('Drop-off') }}" required>
</div>
<div>
<a style="position: absolute;top: 85%;" class="btn btn-primary btn-lg" type="button" style= "width: 100px;" href="{{url('storedata/' , latitude, longitude)}}"> Ride Now </a>
</div>cd..
href =“{{url('storedata /',latitude,longitude)}}”这是我的网址 在路线中发送数据,然后转到我的控制器存储它 lat-lng进入数据库,,,我如何在我的url中发送多个变量?