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.3 KiB

6 years ago
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Ratings</title>
  6. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  7. </head>
  8. <body>
  9. <script>
  10. $.get("https://127.0.0.1:5000/ratings", function(data, status){
  11. if (status == "success") {
  12. data.forEach(function(element) {
  13. var a = document.createElement('a');
  14. var linkText = document.createTextNode(element["name"]);
  15. a.appendChild(linkText);
  16. a.title = element["name"];
  17. a.href = "javascript:results(" + element["id"] + ");";
  18. document.body.appendChild(a);
  19. document.body.appendChild(document.createElement("br"));
  20. });
  21. }
  22. });
  23. function results(id) {
  24. $.get("https://127.0.0.1:5000/ratings/" + id, function(data, status){
  25. if (status == "success") {
  26. var results = document.getElementById("results")
  27. results.innerHTML = '';
  28. for (var key in data["rates"]) {
  29. results.innerHTML += "<p>" + data["rates"][key]["note"] + "</p> " + data["rates"][key]["score"] + "/10 <br><br>"
  30. }
  31. }
  32. });
  33. }
  34. </script>
  35. <div id="results"></div>
  36. </body>
  37. </html>