Get out from smog – part VIII
Today I’ll show the extension of the application with the user selectable range in which “he” can to go.
I added to the view – textbox and submit button.
<input type="number" class="form-control range"/> <button onclick="getLocation()">Find the best place</button>
And script extenstion with additional “range” parametr.
<script type="text/javascript"> function getLocation() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function (position) { var _range= parseFloat($(".range").val()); $.ajax({ url: '@Url.Action("Coordinate", "Home")', data: { 'lat': position.coords.latitude, 'lon': position.coords.longitude,'range' : _range}, type: "post", cache: false, success: function () { }, error: function (thrownError) { alert('Something was wrong'); } }); }); } }; </script>
Application returned me following station.
It looks like the smog from Cracov disappears. 😉
In the next steps I’ll try to visualize the results.
Link to the project.