Importing data into Google Maps from Parse.com database

I’m trying to connect my Parse class to loop through the objects and output markers onto a google map.

The code i’m current trying to use is;

<!DOCTYPE html>
<html>
  <head>
    <style>
      html, body, #map { margin: 0; padding: 0; height: 100%; }
    </style>
    <script
      src="https://maps.googleapis.com/maps/api/js?libraries=visualization">
    </script>
    <script>
      var map;

      function initialize() {
        map = new google.maps.Map(document.getElementById('map'), {
          zoom: 10,
          center: new google.maps.LatLng(53.3478,-6.259),
          mapTypeId: google.maps.MapTypeId.TERRAIN
          // Apply the map style array to the map.
        });

        // Create a <script> tag and set the Parse URL as the source.
        var script = document.createElement('script');
        
        script.src = 'https://pidt6nz9C05S46ykNMXZQPunAPjIULBwnfbrjpVz:javascript-key=oj994YkxqSEyquGL6xr7HpZystcqRCgQuDPJy7bv@api.parse.com/1/classes/SaveASelfie/Selfie';
        
        document.getElementsByTagName('head')[0].appendChild(script);
      }

      // Loop through the results array and place a marker for each
      // set of coordinates.
      window.eqfeed_callback = function(results) {
        for (var i = 0; i < results.features.length; i++) {
          var coords = results.features[i].geometry.coordinates;
          var latLng = new google.maps.LatLng(coords[1],coords[0]);
          var marker = new google.maps.Marker({
            position: latLng,
            map: map
          });
        }
      }
      google.maps.event.addDomListener(window, 'load', initialize)
    </script>
  </head>
  <body>
    <div id="map"></div>
  </body>
</html>`

I’m not connecting to Parse so I know that is the start of my problem. If anyone could point me in the right direction - I’m at the start of my journey into learning javascript.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.