Javascript回调返回结果

时间:2014-08-06 13:46:31

标签: javascript callback return

如何将results返回到placesSearch函数,而不是将results返回到service.nearbySearch函数?感谢

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");
        }        
    }

0 个答案:

没有答案