我正在尝试向我的网站添加一个简单的谷歌地图,其中包含 jQuery 。 我得到的唯一错误是:
GET http://code.jquery.com/jquery.min.map 404 (Not Found)
这里是相关的代码部分,所有插件都在头部:
<!--jquery ,js scripts -->
<link rel="stylesheet" href="styles.css" />
<link rel="stylesheet"href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>
<!--js scripts -->
<script src="jsCode.js"></script>
<script src ="sirJson.js"></script>
<!--gMap plugin API -->
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script src = "gmap.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
Javascript 代码:
$( document ).ready(function() {
var map = new GMaps({
el: '#map',
lat: 51.5073346,
lng: -0.1276831,
zoom: 12,
zoomControl : true,
zoomControlOpt: {
style : 'SMALL',
position: 'TOP_LEFT'
},
panControl : false,
});
最后是我的 html, map 的 jQuery div :
<div data-role="main" class="ui-content">
<div id="map"></div>
</div>
修复了错误 - jQuery's jquery-1.10.2.min.map is triggering a 404 (Not Found)
但是 map 仍然没有显示在 map 页面中。
JS代码:
$( document ).ready(function() {
var map = new GMaps({
el: '#map',
lat: 51.5073346,
lng: -0.1276831,
zoom: 12,
zoomControl : true,
zoomControlOpt: {
style : 'SMALL',
position: 'TOP_LEFT'
},
panControl : false,
});
map - div 元素。
最佳答案
我建议看看 this它清楚地解释了该错误的含义
编辑
更具体。要消除该错误,您需要执行以下操作(我将使用 jquery v1.11.0):
下载 map 文件和未压缩版本的 jQuery。将它们与缩小版本放在一起(同一文件夹)。您可以全部获取here
将缩小(仅缩小)版本包含到您的 HTML( header 中的脚本标记)中。
检查您首选的 js 调试控制台以确保错误已消失。
希望这能让事情变得更清楚。
祝你好运。
关于javascript - Gmap、jQuery 和谷歌地图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25952064/