
{% extends "base.html" %}

{% block content %}
<div class="alert alert-success" role="alert">
<h1>Tracking</h1>
        <input type='text' class='form-control' name='geo' id='geoText' readonly/><br>
        <br>Last Update
        <span id='lastUpdate'></span>
</div>
{% endblock %}
{% block foot_script %}
<script>
    $(function() {

        setInterval(function(){
            console.log("Hello");
            if ("geolocation" in navigator){ //check geolocation available
                //try to get user current location using getCurrentPosition() method
                console.log("current location");
                navigator.geolocation.getCurrentPosition(function(position){
                    console.log("xxxx");
                    $("#geoText").val(position.coords.latitude+","+position.coords.longitude );
                    $("#lastUpdate").html(new Date());

                });
            }else{
                console.log("Browser doesn't support geolocation!");
            }
        }, 5000);
    });
</script>
{% endblock %}
