-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
46 lines (38 loc) · 976 Bytes
/
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
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="js/zepto.min.js"></script>
<script type="text/javascript">
var times,
lat,
lon;
function getTimeStamp(){
myDate = new Date();
timeStamp = myDate.getTime();
}
function getLocation(){
if (navigator.geolocation){
navigator.geolocation.getCurrentPosition(displayPosition);
} else{
geo.innerHTML = "Geolocation is not supported by your browser!";
}
}
function displayPosition(position){
lat = position.coords.latitude;
lon = position.coords.longitude;
getTimeStamp();
submitName();
}
//this function makes an HTTP GET request for /name/username
function submitName() {
$.get("/logdata/name/" + "test" + "/times/" + timeStamp + "/lat/" + lat + "/long/" + lon, function(data) {
console.log(data);
});
}
</script>
</head>
<body onload="getLocation();">
<div id="time"></div>
What's my location?:
</body>
</html>