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.

50 lines
1.8 KiB

6 years ago
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  5. <title>Denunction Info</title>
  6. <meta name="viewport" content="initial-scale=1.0">
  7. <meta charset="utf-8">
  8. </head>
  9. <body>
  10. Denunciated by <div id="by"></div><br>
  11. Information: <br>
  12. <div id="info"></div><br>
  13. Emergency Type: <div id="type"></div><br>
  14. Priority: <div id="prio"></div>
  15. <img src="" id="photo">
  16. <script>
  17. function findGetParameter(parameterName) {
  18. var result = null,
  19. tmp = [];
  20. var items = location.search.substr(1).split("&");
  21. for (var index = 0; index < items.length; index++) {
  22. tmp = items[index].split("=");
  23. if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1]);
  24. }
  25. return result;
  26. }
  27. let den_id = findGetParameter("id");
  28. $.get("https://127.0.0.1:5000/denunciations", function(dataStr, status){
  29. data = $.parseJSON(dataStr)
  30. if (status == "success") {
  31. data.forEach(function(element) {
  32. if (element["id"] == den_id) {
  33. $.get("https://127.0.0.1:5000/users/" + element["reporter"], function(dataStr, status) {
  34. data = $.parseJSON(dataStr)
  35. document.getElementById("by").innerHTML = data["realname"]
  36. });
  37. document.getElementById("info").innerHTML = element["info"]
  38. document.getElementById("type").innerHTML = element["emergency"]
  39. document.getElementById("prio").innerHTML = element["priority"]
  40. document.getElementById("photo").src = "data:image/jpeg;base64," + element["photo"]
  41. }
  42. });
  43. }
  44. });
  45. </script>
  46. </body>
  47. </html>