0

Can anyone explain what i am doing wrong here? I am working with jQuery $.getJSON along with Google Maps both of which i am a newbie. Originally I was using standard JavaScript but have decided to using jQuery because XMLHttpRequest was not working in Chrome or within jsfiddle and it is to my understand that I will not have to worry about these issues using .$getJSON, however i now have to reconstruct my code to work properly in 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>

  • Please fix the syntax errors first (hint: missing "v" in first line. then the `url: ...` part doesn't make sense at al) – Prinzhorn Oct 02 '12 at 20:02

1 Answers1

0

You need to work on your url string cause it doesn't work. I suggest you begin with something simple like (http://jquery-ui-map.googlecode.com/svn/trunk/demos/json/demo.json), and work around the JSON format to edit your test data with a same response from your desired http://www.artectodesignstudios.com/RSSData.txt request. Hope it helps. :)

Ani
  • 1,655
  • 3
  • 23
  • 37
gk5tudio
  • 3
  • 2