|
|
- <!DOCTYPE html>
- <html>
- <head>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
- <title>Denunction Info</title>
- <meta name="viewport" content="initial-scale=1.0">
- <meta charset="utf-8">
- </head>
- <body>
- Denunciated by <div id="by"></div><br>
- Information: <br>
- <div id="info"></div><br>
- Emergency Type: <div id="type"></div><br>
- Priority: <div id="prio"></div>
- <img src="" id="photo">
-
- <script>
- function findGetParameter(parameterName) {
- var result = null,
- tmp = [];
- var items = location.search.substr(1).split("&");
- for (var index = 0; index < items.length; index++) {
- tmp = items[index].split("=");
- if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1]);
- }
- return result;
- }
- let den_id = findGetParameter("id");
-
- $.get("https://127.0.0.1:5000/denunciations", function(dataStr, status){
- data = $.parseJSON(dataStr)
-
- if (status == "success") {
- data.forEach(function(element) {
- if (element["id"] == den_id) {
- $.get("https://127.0.0.1:5000/users/" + element["reporter"], function(dataStr, status) {
- data = $.parseJSON(dataStr)
- document.getElementById("by").innerHTML = data["realname"]
- });
- document.getElementById("info").innerHTML = element["info"]
- document.getElementById("type").innerHTML = element["emergency"]
- document.getElementById("prio").innerHTML = element["priority"]
- document.getElementById("photo").src = "data:image/jpeg;base64," + element["photo"]
- }
- });
- }
- });
- </script>
- </body>
- </html>
|