index.html 902 B

12345678910111213141516171819202122232425262728293031
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Lee Morgan</title>
  6. </head>
  7. <body>
  8. <div id="images"></div>
  9. <script>
  10. let path = window.location.pathname
  11. .split("/")
  12. .slice(2)
  13. .join("/");
  14. fetch(`/travel/images/${path}`)
  15. .then(response => response.json())
  16. .then((response)=>{
  17. let container = document.getElementById("images");
  18. for(let i = 0; i < response.length; i++){
  19. let img = document.createElement("img");
  20. img.src = response[i];
  21. img.alt = "A picture";
  22. container.appendChild(img);
  23. }
  24. })
  25. .catch(err => {});
  26. </script>
  27. </body>
  28. </html>