Created
December 13, 2025 18:01
-
-
Save davidystephenson/027bfe82f6e05afd62e0c65b0d310310 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function getOrders () { | |
| const tbody = document.querySelector('tbody') | |
| const response = await fetch('http://localhost:3000/orders') | |
| const data = await response.json() | |
| console.log('data', data) | |
| /* | |
| date: "Dec 21, 2022 12:04 (ET)" | |
| id: "6789" | |
| name: "Alina Thomas" | |
| orderStatus: "Processing" | |
| paymentStatus: "Paid" | |
| price: 600 | |
| */ | |
| for (const order of data) { | |
| tbody.innerHTML += ` | |
| <tr> | |
| <td>${order.id}</td> | |
| <td>${order.date}</td> | |
| <td>${order.name}</td> | |
| <td>${order.price}</td> | |
| <td>${order.paymentStatus}</td> | |
| <td>${order.orderStatus}</td> | |
| <td></td> | |
| </tr> | |
| ` | |
| } | |
| } | |
| getOrders() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment