|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
|
2
|
+{% extends "base.html" %}
|
|
|
3
|
+
|
|
|
4
|
+{% block content %}
|
|
|
5
|
+<div class="alert alert-success" role="alert">
|
|
|
6
|
+<h1>Tracking</h1>
|
|
|
7
|
+ <input type='text' class='form-control' name='geo' id='geoText' readonly/><br>
|
|
|
8
|
+ <br>Last Update
|
|
|
9
|
+ <span id='lastUpdate'></span>
|
|
|
10
|
+</div>
|
|
|
11
|
+{% endblock %}
|
|
|
12
|
+{% block foot_script %}
|
|
|
13
|
+<script>
|
|
|
14
|
+ $(function() {
|
|
|
15
|
+
|
|
|
16
|
+ setInterval(function(){
|
|
|
17
|
+ console.log("Hello");
|
|
|
18
|
+ if ("geolocation" in navigator){ //check geolocation available
|
|
|
19
|
+ //try to get user current location using getCurrentPosition() method
|
|
|
20
|
+ console.log("current location");
|
|
|
21
|
+ navigator.geolocation.getCurrentPosition(function(position){
|
|
|
22
|
+ console.log("xxxx");
|
|
|
23
|
+ $("#geoText").val(position.coords.latitude+","+position.coords.longitude );
|
|
|
24
|
+ $("#lastUpdate").html(new Date());
|
|
|
25
|
+
|
|
|
26
|
+ });
|
|
|
27
|
+ }else{
|
|
|
28
|
+ console.log("Browser doesn't support geolocation!");
|
|
|
29
|
+ }
|
|
|
30
|
+ }, 5000);
|
|
|
31
|
+ });
|
|
|
32
|
+</script>
|
|
|
33
|
+{% endblock %}
|