Javascript 谷歌地图与Phonegap

Javascript 谷歌地图与Phonegap,javascript,google-maps,google-maps-api-3,cordova,Javascript,Google Maps,Google Maps Api 3,Cordova,我用Phonegap创建了一个小的移动应用程序。 它包含一个HTML页面(index.HTML)。该文件包含一个Google地图,上面根据远程XML文件放置了标记。 地图已加载,但未放置任何标记。 我不知道这是由于远程XML文件还是Phonegap的错误使用。 文件位置为“” 这是我的密码: <!DOCTYPE html> <html> <head> <title>NextNine customer ma

我用Phonegap创建了一个小的移动应用程序。 它包含一个HTML页面(index.HTML)。该文件包含一个Google地图,上面根据远程XML文件放置了标记。 地图已加载,但未放置任何标记。 我不知道这是由于远程XML文件还是Phonegap的错误使用。 文件位置为“”

这是我的密码:

    <!DOCTYPE html>
    <html>
      <head>
        <title>NextNine customer map</title>
       <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <META HTTP-EQUIV="Refresh" CONTENT="500">
    <style>
      html, body, #map-canvas {
        height: 100%;
        margin: 0px;
        padding: 0px
      }

       .labels {
     color: orange;
     background-color: black;
     font-family: "Lucida Grande", "Arial", sans-serif;
     font-size: 10px;
     font-weight: bold;
     text-align: center;
     width: 100px;     
     border: 2px solid black;
     white-space: nowrap;}
    </style>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script src="https://jquery-xml2json-plugin.googlecode.com/svn/trunk/jquery.xml2json.js"></script>
    <script src="https://maps.googleapis.com/maps/api/js?v=3&sensor=false"></script>
    <script src="http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerwithlabel/1.0.1/src/markerwithlabel.js"></script>
    <script>
      var markers = [];
      var map = null;
      var counter =0;
      var counter_part =0;

function initialize() {
    var chicago = new google.maps.LatLng(35.890026,-5.523652);
    var mapOptions = {
        zoom: 3,
        center: chicago,
        mapTypeId: google.maps.MapTypeId.ROADMAP 
  }

  map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
}
google.maps.event.addDomListener(window, 'load', initialize);

  $.get('http://nnscc.mydomain.com/gmap/Customers.xml', function(xml) {
      var jsonObj = $.xml2json(xml);
        $.each(jsonObj.Marker, function(){
            var stat = this.status == "Critical" ? 'http://maps.google.com/mapfiles/ms/micons/red-dot.png' : 'http://maps.google.com/mapfiles/ms/micons/green-dot.png';
                 var mark = {
                        title: this.title,
                        latitude: this.latitude,
                        longitude: this.longitude,
                        icon: stat
                        }
                markers.push(mark);
        });
        for(var i=0; i< markers.length; i++){
          var lon = markers[i].longitude;
          var lat = markers[i].latitude;
          var image = markers[i].icon;
          var custname = markers[i].title;
          PlaceMarker(lat,lon, image, custname); 
        } 
});     

function PlaceMarker(lat, lon, image, custname) {

     var myLatlng = new google.maps.LatLng(lat,lon);
     var marker = new MarkerWithLabel({
       position: myLatlng,
       map: map,
       icon: image,
       labelContent: custname,
       labelAnchor: new google.maps.Point(22, 0),
       labelClass: "labels", // the CSS class for the label
       labelStyle: {opacity: 0.75}
     });
}

function recenter ()
{
    var location = new google.maps.LatLng(markers[counter].latitude,markers[counter].longitude);
    map.setCenter (location);
    map.setZoom (9);
}

function centerback()
{
    var location = new google.maps.LatLng(35.890026,-5.523652);
    map.setCenter (location);
    map.setZoom (3);
}

window.setInterval(function(){
  recenter();
  if(counter==(markers.length-1))
  {
    counter=0;
    counter_part=0;
    centerback();
  }
  else
  {
    if(counter_part==5)
    {
        centerback();
        counter_part=0;}
    else
        {
            recenter();
            counter++;
            counter_part++;}
  }

}, 15000);
    </script>
  </head>
  <body>
     <div id="map-canvas"></div>
  </body>
</html>

NextNine客户地图
html,正文,#地图画布{
身高:100%;
边际:0px;
填充:0px
}
.标签{
颜色:橙色;
背景色:黑色;
字体系列:“Lucida Grande”,“Arial”,无衬线;
字体大小:10px;
字体大小:粗体;
文本对齐:居中;
宽度:100px;
边框:2件纯黑;
空白:nowrap;}
var标记=[];
var-map=null;
var计数器=0;
var计数器_部分=0;
函数初始化(){
var chicago=new google.maps.LatLng(35.890026,-5.523652);
变量映射选项={
缩放:3,
中心:芝加哥,
mapTypeId:google.maps.mapTypeId.ROADMAP
}
map=new google.maps.map(document.getElementById('map-canvas'),mapOptions);
}
google.maps.event.addDomListener(窗口“加载”,初始化);
$.get('http://nnscc.mydomain.com/gmap/Customers.xml,函数(xml){
var jsonObj=$.xml2json(xml);
$.each(jsonObj.Marker,function(){
var stat=this.status==“严重”?'http://maps.google.com/mapfiles/ms/micons/red-dot.png' : 'http://maps.google.com/mapfiles/ms/micons/green-dot.png';
变量标记={
标题:这个,
纬度:这个纬度,
经度:这个经度,
图标:stat
}
标记。推(标记);
});
对于(var i=0;i

提前感谢。

您是否在配置文件中编辑了访问块以将url列入白名单?此处的文档: