Jquery ui Google Map API V3 directionsService.route在mvc 4中不起作用

Jquery ui Google Map API V3 directionsService.route在mvc 4中不起作用,jquery-ui,google-maps,asp.net-mvc-4,google-maps-api-3,dialog,Jquery Ui,Google Maps,Asp.net Mvc 4,Google Maps Api 3,Dialog,在“我的对话框”中,无法路由贴图方向 <script> var directionsDisplay; var directionsService = new google.maps.DirectionsService(); function calcRoute() { var myLoc = MyLoc; // My location var Dest = DesLoc; // Destination Location var request

在“我的对话框”中,无法路由贴图方向

<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();
});

var方向显示;
var directionsService=new google.maps.directionsService();
函数calcRoute(){
var myLoc=myLoc;//我的位置
var Dest=DesLoc;//目标位置
var请求={
来源:myLoc,
目的地:目的地,
travelMode:google.maps.Directions travelMode.DRIVING
};   
路由(请求、函数(响应、状态){
if(status==google.maps.directionstatus.OK){
方向显示。设置方向(响应);
}
});
}
函数初始化(){
myLatLng=新的google.maps.LatLng(lat,lng);
变量映射选项={
中心:myLatLng,
缩放:15,
mapTypeId:google.maps.mapTypeId.ROADMAP
};
map=new google.maps.map(document.getElementById(“maplarge_canvas”),
地图选项);
directionsDisplay=新建google.maps.DirectionsRenderer({
真的吗
});
方向显示.setMap(地图);
}
功能成功(职位){
document.getElementById(“hidMyLoc”).value=position.coords.latitude+,“+position.coords.longitude;
} 
$(函数(){
//google.maps.event.addDomListener(窗口“加载”,初始化);
初始化();
});

函数中的CalCrout()无法运行。路由(请求、功能(响应、状态)

在我的html中

<input type="button" id="btn_submit" value="Get Direction" onclick="calcRoute();" />
<div id="maplarge_canvas" style="width: 850px; height: 500px;"></div>

当单击按钮调用calRoute()函数时

此函数无法通过directionService.route运行,firebug无法在js中看到错误


注:此代码运行在Dialog Jquery UI上

我相信这很晚才出现,但只是通过查看它并供将来查看

google.maps.DirectionsTravelMode.DRIVING
应该是

google.maps.TravelMode.DRIVING