1
試圖從googleapi得到地圖,在Firebug返回網絡錯誤:ASP.NET MVC5 GOOGLEMAPS
"NetworkError: 404 Not Found - http://localhost:15618/Home/https//maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&key=MY_KEY"
源代碼,聯繫的觀點:
<script type="text/javascript" src="https//maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&key=MY_KEY"></script>
@section腳本{
function initialize() { var canvas = $("#map_canvas"); var latitude = 30.3296604; var longitude = -97.8743174; var latlng = new google.maps.LatLng(latitude, longitude); var options = { zoom: 8, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(canvas[0], options); var marker = new google.maps.Marker({ position: new google.maps.LatLng(latitude, longitude), map: map }); } $(function() { //Same as $(document).ready() initialize(); }); </script> }
我試圖在BundleConfig.cs使用CDN,無果而終
bundles.UseCdn = true;
BundleTable.EnableOptimizations = true; //force optimization while debugging
var jquery = new ScriptBundle("~/bundles/jquery", "https//maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&key=AIzaSyALDo0MgNC8vRSNN3It38Yo9L_g8_8GoqM").Include(
"~/Scripts/jquery-{version}.js");
bundles.Add(jquery);
我和ASP.NET的經驗,但...這'@section腳本{'已關閉''並沒有打開標籤'