Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// Create array for storing results
var agencies = [];
function callback(results, status) {
if (status === google.maps.places.PlacesServiceStatus.OK) {
for (var i = 0; i < results.length; i++) {
//Fetch the ID of each Place returned by the Radar Search
var request = {
placeId: results[i]['place_id']
// Call the Places API Web Service
service = new google.maps.places.PlacesService(map);
// Initiate Place Details request
service.getDetails(request, callback);
function callback(place, status) {
if (status == google.maps.places.PlacesServiceStatus.OK) {
agencies.push([,, place.rating]);
// When reaching the last result, send to PHP file to print results
if(results.length == agencies.length){
var request = new XMLHttpRequest();'POST', 'http://localhost/agency-map/src/save.php', true);
request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.