An app written in GoLang to find people using location services on smartphones.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.1KB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Location</title>
  5. <script>
  6. function getLocation() {
  7. var post = new XMLHttpRequest();
  8. post.open("GET", "/api/location?id={{.Id}}&key={{.Key}}", true);
  9. post.send();
  10. post.onload = function () {
  11. switch ( this.status ) {
  12. case 404:
  13. document.getElementById("shared").innerHTML = "This Location Id does not appear to exist";
  14. break;
  15. case 204:
  16. document.getElementById("shared").innerHTML = "The Location is currently empty, retrying in 5 seconds";
  17. setTimeout(getLocation, 5000);
  18. break;
  19. case 200:
  20. document.getElementById("shared").innerHTML = "Location Retrived";
  21. var location = JSON.parse(this.response);
  22. document.getElementById("location").innerHTML = "Latitude: " + location.latitude + ", Longitude: " + location.longitude;
  23. break;
  24. default:
  25. document.getElementById("shared").innerHTML = "There was a problem";
  26. }
  27. };
  28. }
  29. window.onload = getLocation;
  30. </script>
  31. </head>
  32. <body>
  33. <p id="shared"></p>
  34. <p id="location"></p>
  35. </body>
  36. </html>