-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
161 lines (123 loc) · 3.53 KB
/
index.html
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<!DOCTYPE html>
<html>
<head>
<title>Save a Place</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" integrity="sha256-7s5uDGW3AHqw6xtJmNNtr+OBRJUlgkNJEo78P4b0yRw= sha512-nNo+yCHEyn0smMxSswnf/OnX6/KwJuZTlNZBjauKhTK0c+zT+q5JOCx0UFhXQ6rJR9jg6Es8gPuD2uZcYDLqSw==" crossorigin="anonymous">
<STYLE>
html, body{
height: 100%;
}
.absolute-wrapper{
position: absolute;
z-index: 99;
position: absolute;
width:100%;
}
#map_canvas2{
width: 100%;
height: 100%;
postion: absolute;
z-index: 0;
}
.map-container{
background: rgba(169,68,66,.5);
height: 100%;
width: 100%;
position: absolute;
top: 0;
left: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 1;
}
</STYLE>
</head>
<body>
<section class="where-next">
<div class="absolute-wrapper">
<div class="container">
upper cool content
<div class="jumbotron">
<div class="container">
<form class="ajax form-inline">
<div class="form-group">
<label for="exampleInputAmount">Find a place</label>
<div class="input-group">
<input type="text" class="form-control" id="location" placeholder="Location">
</div>
</div>
<button type="submit" class="btn btn-primary">Submit to JSON</button>
</form>
</div>
</div>
</div>
</div>
<div id="map_canvas2"><div class="map-container"></div>
</div>
</section>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?libraries=geometry,places">
</script>
<script src="jquery.geocomplete.min.js"></script>
<script>
///////GOOGLE MAPS
function initialize() {
var mapOptions = {
center: new google.maps.LatLng(53.408371, -2.991573),
zoom: 6,
noClear: true,
disableDefaultUI: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
ma2p = new google.maps.Map(document.getElementById("map_canvas2"), mapOptions);
$.getJSON('my_json_data.json', function(data) {
$.each( data.votes, function(i, value) {
var myLatlng = new google.maps.LatLng(value.lat, value.lng);
//alert(myLatlng);
var marker = new google.maps.Marker({
position: myLatlng,
map: ma2p,
title: "text "+value.lng
});
});
});
};
google.maps.event.addDomListener(window, 'load', initialize);
var option = {
types: ['(cities)'],
country: 'GB'
};
var latco, lngco;
$("#location").geocomplete(option).bind("geocode:result", function(event, result) {
latco = result.geometry.location.lat()
lngco = result.geometry.location.lng()
});
$(document).ready(function() {
$('form.ajax').on('submit', function(e) {
e.preventDefault();
var params = {
lat: latco,
lng: lngco,
}
$.ajax({
type: 'POST',
data: params,
url: 'save_to_json.php',
success: function(data) {
console.log('success');
console.log(data);
},
error: function(data) {
console.log('error');
console.log(data);
},
complete: function() {
console.log('complete');
}
});
return false;
});
});
</script>
</body>
</html>