-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweek_9_mashup.html
More file actions
69 lines (63 loc) · 1.81 KB
/
week_9_mashup.html
File metadata and controls
69 lines (63 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<title>Simple Map</title>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#map {
height: 100%;
}
</style>
</head>
<body>
<button id="submit">Mark Suburbs</button>
<div id="map"></div>
<script>
$(document).ready(function(){
$("#submit").click(function(){
$.ajax( {
url: "http://api.geonames.org/postalCodeSearchJSON?country=AU&postalcode=4556&maxRows=10&username=wangmz",
method: "get",
dataType: "json"
})
.done( function(data) {
var result = data.postalCodes;
for ( var i = 0; i < result.length; i++ ) {
marker = new google.maps.Marker({
map: map,
position: {lat: result[i].lat, lng: result[i].lng},
title: result[i].placeName
});
}
// Set Sample Bubble Marker
var myTown = 'sippy-downs';
var myCont = '<div><p> Information: <a href=" https://www.queensland.com/en-au/destination-information/' + myTown + '" target="_blank">Local Info</a></p></div>';
var infowindow = new google.maps.InfoWindow({
content: myCont
});
marker.addListener('click', function() {
infowindow.open(map, marker);
});
map.setCenter(marker.getPosition());
});
});
});
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -26.715, lng: 153.064},
zoom: 12
});
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCO3hE4bE7WV7mGuXL4kn9caoWI44tD8Ic&callback=initMap"
async defer></script>
</body>
</html>