var unique_interests = window.facebook_interests.filter((v, i, a) => 
a.indexOf(v) === i);
       
       
       var input = map.getCenter();
       var a = input.lat();
       var b = input.lng();
       
       var latlng = {lat: a, lng: b};
       
       window.markersGP = [];
       
    
       
       for(var i=0; i<unique_interests.length; i++)
       {
       
       
       var request = {
    location: latlng,
    radius: '500',
    query: unique_interests[i]
  };
       
       
       console.log(request);
      
       service = new google.maps.places.PlacesService(map);
       service.textSearch(request, function (results, status){
           
           
           alert(request.query);
       
       
           
       });


Whenever the callback functions are called, the for loop has executed 
completely, and the alert() always print out the last value in the array. 
Is there any way to bind the data with the function call?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-maps-js-api-v3+unsubscr...@googlegroups.com.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
Visit this group at https://groups.google.com/group/google-maps-js-api-v3.
For more options, visit https://groups.google.com/d/optout.

Reply via email to