| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <link rel="stylesheet" href="/currency/style">
- <title>Lee Morgan</title>
- </head>
- <body>
- <div id="container">
- <template id="currency">
- <div class="currency">
- <h1 class="location"></h1>
- <p class="info"></p>
- <img class="frontImage">
- <img class="backImage">
- <p class="comment"></p>
- </div>
- </template>
- </div>
- <script>
- fetch("/currency/data")
- .then(r=>r.json())
- .then((response)=>{
- let container = document.getElementById("container");
- let template = document.getElementById("currency").content.children[0];
- for(let i = 0; i < response.length; i++){
- let currency = template.cloneNode(true);
- currency.querySelector(".location").innerText = response[i].location.toUpperCase();
- currency.querySelector(".info").innerText = `${response[i].value} ${response[i].name} (${response[i].year})`;
- currency.querySelector(".frontImage").src = response[i].frontImage;
- currency.querySelector(".backImage").src = response[i].backImage;
- currency.querySelector(".comment").innerText = response[i].comment;
- container.appendChild(currency);
- }
- })
- .catch((err)=>{});
- </script>
- </body>
- </html>
|