Open javywithawhy opened 1 year ago
<!doctype html> <html> <head> <style> h1 { text-align: center } table, th, td { border: 1px solid black; border-collapse: collapse; padding: 5px; } th { background-color: grey; color: black; } </style> <script language="javascript"> window.addEventListener("load", readAll) function readAll() { fetch("http://localhost:7777/retrieve2") .then(response => response.json()) .then(function(data) { let table = '<table><thead><tr><th>PO Number</th><th>Tracking Number</th><th>Origin</th><th>destination</th></tr></thead><tbody>'; data.forEach(row => table += `<tr><td>${row.po_number}</td><td>${row.tracking_number}</td><td>${row.origin}</td><td>${row.destination}</td></tr>`); table += '</tbody></table>'; document.getElementById("records").innerHTML = table; // Add back button event listener var backButton = document.getElementById("backButton"); backButton.addEventListener("click", function() { window.history.back(); }); }) } </script> </head> <body style="background-color:slategrey;"> <h1 style="font-family:lato;">Inventory Tracking</h1> <button id="backButton">Back</button> <div id="updateList"></div> <body style="background-color:slategrey;"> <div id="records"></div> </body> </html>