谁能解释我在这里做错了什么?我正在使用 jQuery $.getJSON 和谷歌地图,我都是新手。最初我使用的是标准 JavaScript,但决定使用 jQuery,因为 XMLHttpRequest 在 Chrome 或 jsfiddle 中不起作用,据我了解,我不必担心使用 .$getJSON 的这些问题,但是我现在必须重建我的代码在 jQuery 中正常工作。
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Google Maps Multiple Markers - jQuery JSON</title>
<script src="http://maps.google.com/maps/api/js?sensor=false"
type="text/javascript"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.ui.map.js"></script>
</head>
<body>
<div id="map_canvas" style="width: 800px; height: 600px;"></div>
<script type="text/javascript">
$(function(){
$('#map_canvas').gmap().bind('init', function(){
$.getJSON('http://www.artectodesignstudios.com/RSSData.txt', function(data){
$.each(data.title, function(i, marker){
$('#map_canvas').gmap('addMarker',{
'position': new google.maps.LatLng(marker[i]["geo:lat"], marker[i]["geo:long"]),
'bounds':true
}).click(function(){
$('#map_canvas').gmap('openInfoWindow', {'content': marker.content}, this);
});
});
});
});
});
<script>
</body>
</html>
</p>