-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIndex.html
More file actions
59 lines (50 loc) · 977 Bytes
/
Index.html
File metadata and controls
59 lines (50 loc) · 977 Bytes
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!doctype html>
<html>
<head>
<meta
<title></title>
<style>
table,tr,td,th
{
border:1px solid black;
}
</style>
</head>
<body>
<table id ="CustomerTable">
<thead>
<tr>
<th>ID</th>
<th>Customer Name</th>
<th>Customer Contact</th>
<th>OrderId</th>
<th>City</th>
</tr>
</thead>
<tbody></tbody>
</table>
<script>
fetch("Customer.json")
.then(response=>response.json())
.then(data=>{
let tableBody=document.querySelector("#CustomerTable tbody");
data.forEach(Record=>
{
let row=document.createElement("tr");
row.innerHTML=
`<td>${Record.id}</td>
<td>${Record.Name}</td>
<td>${Record.Contact}</td>
<td>${Record.OrderId}</td>
<td>${Record.City}</td>`;
tableBody.append(row);
});
})
.catch(err=>
{
console.log("Failed",err);
}
);
</script>
</body>
</html>