Skip to content

Instantly share code, notes, and snippets.

@tomodutch
Created May 12, 2018 08:13
Show Gist options
  • Save tomodutch/7b4eb9881a81a218d9c7f0469b469b4e to your computer and use it in GitHub Desktop.
Save tomodutch/7b4eb9881a81a218d9c7f0469b469b4e to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>places</title>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=[KEY]&libraries=places"></script>
<style media="screen">
#map {
height: 100vh;
width: 100vw;
}
</style>
</head>
<body>
<input type="search" id="search" name="" value="">
<div id="map"></div>
<script type="text/javascript">
(function() {
var map;
var service;
var infowindow;
function initialize() {
var pyrmont = new google.maps.LatLng(51.5491448,4.0767226);
map = new google.maps.Map(document.getElementById('map'), {
center: pyrmont,
zoom: 15
});
var request = {
location: pyrmont,
radius: '500',
type: ['school']
};
service = new google.maps.places.PlacesService(map);
service.nearbySearch(request, callback);
document.getElementById('search').addEventListener('keyup', function(e) {
var request = {
location: pyrmont,
radius: '500000',
type: 'school',
query: e.target.value
};
debugger;
service.textSearch(request, callback);
});
}
function callback(results, status) {
debugger;
}
initialize();
})();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment