0

How can I get results returned to placesSearch function, rather than returning results to service.nearbySearch function? Thanks

function placesSearch(map,myLatlng,myBusinessName) {

        var searchArea = myLatlng;

        var request = {
            location: searchArea,
            radius: 500
        };

        var service = new google.maps.places.PlacesService(map);

        var googleBusNames = service.nearbySearch(request, callback);

        validateFeature(googleBusNames,myBusinessName);
    }

    function callback(results, status) {

        if (status == google.maps.places.PlacesServiceStatus.OK) {
            return results;
        }
        else {
            console.log("Error");
        }        
    }
RustyShackleford
  • 25,262
  • 6
  • 22
  • 38
  • You can't. That's why the function accepts a callback in the first place. – Quentin Aug 06 '14 at 13:48
  • I think the closure was a bit hasty. A long community wiki is going to take a lot longer to process if the user is confused about callbacks than a relevant answer to this question. – DF_ Aug 06 '14 at 13:52

0 Answers0