C# 如何在JS文件中引用GoogleMap标记

C# 如何在JS文件中引用GoogleMap标记,c#,jquery,asp.net,asp.net-mvc,C#,Jquery,Asp.net,Asp.net Mvc,我正在使用ASP.NETMVC,我们使用一个外部的.JS文件来放置所有javascript代码。 我首先把下面的谷歌地图代码放在视图中,在视图页面中显示地图效果很好。。。但是当我发送代码进行代码审查时,代码审查人员要求我在.JS文件中引用它。我多次尝试将它放在.JS文件中,但无法在视图中显示它 似乎他们希望google map初始化变量和google map js脚本位于js文件airlandetail.js中,并且只在查看页面中有引用。他们想要干净的代码/视图页面 你能帮忙吗

我正在使用ASP.NETMVC,我们使用一个外部的.JS文件来放置所有javascript代码。 我首先把下面的谷歌地图代码放在视图中,在视图页面中显示地图效果很好。。。但是当我发送代码进行代码审查时,代码审查人员要求我在.JS文件中引用它。我多次尝试将它放在.JS文件中,但无法在视图中显示它

似乎他们希望google map初始化变量和google map js脚本位于js文件airlandetail.js中,并且只在查看页面中有引用。他们想要干净的代码/视图页面

你能帮忙吗

                            <div class="googleMapAPI">
                            @{
                                var googleAPIKey = ConfigurationSettings.AppSettings["CWU_GoogleAPI_Key"];
                                <script src="https://maps.googleapis.com/maps/api/js?key=@googleAPIKey&callback=initMap" type="text/javascript"></script>
                            }
airlandetails.js文件中有如下代码

$(function () {    

    Initialize();        
});

function Initialize() {

google.maps.visualRefresh = true;

var propertyLatitude = document.getElementById("latitudId").value;
var propertyLongitude = document.getElementById("longitudId").value;
var propertyLocation = new google.maps.LatLng(propertyLatitude, propertyLongitude);
var mapOptions = {
    zoom: 14,
    center: propertyLocation,
    mapTypeId: google.maps.MapTypeId.G_NORMAL_MAP
};

var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
var myLatlng = new google.maps.LatLng(propertyLatitude, propertyLongitude);
var marker = new google.maps.Marker({
    position: myLatlng,
    map: map,
    title: 'Location found'
});


marker.setIcon('http://maps.google.com/mapfiles/ms/icons/green-dot.png')

}

尝试将脚本标记放入节中,即:

<html>
<head>
@Scripts.Render("~/Scripts/Views/Product/airplanDetail.js")
</head>
<body>
</body>
</html>

@Scripts.Render(“~/Scripts/Views/Product/airlandetail.js”)

为什么没有人想回复?17个视图,但0个人想要帮助。先生/女士,我真的需要帮助。我被困了一整天。
<html>
<head>
@Scripts.Render("~/Scripts/Views/Product/airplanDetail.js")
</head>
<body>
</body>
</html>