-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
32 lines (27 loc) · 1.13 KB
/
script.js
File metadata and controls
32 lines (27 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const url = 'https://isro.vercel.app/api/customer_satellites';
fetch(url)
.then(response => response.json())
.then(data => {
const satellites = data.customer_satellites;
const tableBody = document.querySelector('#satellitesTable tbody');
satellites.forEach(satellite => {
const row = document.createElement('tr');
const idCell = document.createElement('td');
const countryCell = document.createElement('td');
const launchDateCell = document.createElement('td');
const launcherCell = document.createElement('td');
const massCell = document.createElement('td');
idCell.textContent = satellite.id;
countryCell.textContent = satellite.country;
launchDateCell.textContent = satellite.launch_date;
launcherCell.textContent = satellite.launcher;
massCell.textContent = satellite.mass;
row.appendChild(idCell);
row.appendChild(countryCell);
row.appendChild(launchDateCell);
row.appendChild(launcherCell);
row.appendChild(massCell);
tableBody.appendChild(row);
});
})
.catch(error => console.error(error));