title: Display search results on Google Maps
body: <p>At the moment the website is coded in PHP and results get pulled from a database using API url. The search result returns 10 items by default which needs to be plotted on the map.</p>
  
  <p>This is my code so far:</p>
  
  <pre><code>&lt;?php
  // Loading Domus API
  $url_search = 'http://url/site/go/api/search';
  $xml_search = @simplexml_load_file($url_search) or die ("no file loaded") ;
  //Displaying latitude and longutude
  $xml_search = json_decode($xml_search);
  foreach($xml_search-&gt;property as $house) { 
      echo $lat = $house-&gt;address-&gt;latitude , $long = $house-&gt;address-&gt;longitude;
      };
  </code></pre>
  
  <p>?></p>
  
  <p>Then I have the JavaScripts</p>
  
  <pre><code>var locations = [
  
  ];
  
  var map = new google.maps.Map(document.getElementById('map'), {
    zoom: 10,
    center: new google.maps.LatLng(-33.92, 151.25),
    mapTypeId: google.maps.MapTypeId.ROADMAP
  });
  
  var infowindow = new google.maps.InfoWindow();
  
  var marker, i;
  
  for (i = 0; i &lt; locations.length; i++) {  
    marker = new google.maps.Marker({
      position: new google.maps.LatLng(locations[i][1], locations[i][2]),
      map: map
    });
  
    google.maps.event.addListener(marker, 'click', (function(marker, i) {
      return function() {
        infowindow.setContent(locations[i][0]);
        infowindow.open(map, marker);
      }
    })(marker, i));
  }
  </code></pre>
  
  <p>But this does not work, of course. </p>