Dans ma boîte de dialogue ne peut pas la direction de feuille de routeGoogle Map API V3 directionsService.route fonctionne pas dans mvc 4
<script>
var directionsDisplay;
var directionsService = new google.maps.DirectionsService();
function calcRoute() {
var myLoc = MyLoc; // My location
var Dest = DesLoc; // Destination Location
var request = {
origin: myLoc,
destination: Dest,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function (response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
}
function initialize() {
myLatLng = new google.maps.LatLng(lat, lng);
var mapOptions = {
center: myLatLng,
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("maplarge_canvas"),
mapOptions);
directionsDisplay = new google.maps.DirectionsRenderer({
suppressMarkers: true
});
directionsDisplay.setMap(map);
}
function success(position) {
document.getElementById("hidMyLoc").value = position.coords.latitude + ',' + position.coords.longitude;
}
$(function() {
// google.maps.event.addDomListener(window, 'load', initialize);
initialize();
});
en fonction calcroute() ne peut pas courir à travers. directionsService.route (demande, fonction (réponse, état)
dans mon html
<input type="button" id="btn_submit" value="Get Direction" onclick="calcRoute();" />
<div id="maplarge_canvas" style="width: 850px; height: 500px;"></div>
Lorsque le bouton de clic pour appeler la fonction calRoute()
cette fonction ne peut pas exécuter par directionService.route et Firebug ne peut pas voir erreur dans js
PS. ce code execute sur Dialog jQuery UI