×
    Get a Quote
    Local Business Listing App

    Local Business Listing App

    4.0
    X - Close
    document.getElementById('search-button').addEventListener('click', searchLocalBusinesses); function searchLocalBusinesses() { const city = document.getElementById('city').value; const minReviews = document.getElementById('min-reviews').value; const minRating = document.getElementById('min-rating').value; const service = new google.maps.places.PlacesService(document.getElementById('map')); const request = { location: new google.maps.LatLng(37.7749, -122.4194), // San Francisco coordinates radius: 50000, // 50 km radius type: ['restaurant'], minRating: minRating, openNow: true }; service.nearbySearch(request, (results, status) => { if (status === google.maps.places.PlacesServiceStatus.OK) { const filteredResults = results.filter(place => place.user_ratings_total >= minReviews); displayResults(filteredResults); } else { console.error('Error searching for local businesses:', status); } }); } function displayResults(places) { const map = new google.maps.Map(document.getElementById('map'), { zoom: 12, center: new google.maps.LatLng(37.7749, -122.4194) // San Francisco coordinates }); places.forEach(place => { const marker = new google.maps.Marker({ position: place.geometry.location, map: map, title: place.name }); const infoWindow = new google.maps.InfoWindow({ content: `

    ${place.name}

    Rating: ${place.rating} (${place.user_ratings_total} reviews)

    ${place.vicinity}

    ` }); marker.addListener('click', () => { infoWindow.open(map, marker); }); }); } document.getElementById('min-rating').addEventListener('input', () => { document.getElementById('min-rating-value').textContent = document.getElementById('min-rating').value; });