-
Notifications
You must be signed in to change notification settings - Fork 0
/
jsontable.html
51 lines (36 loc) · 1.08 KB
/
jsontable.html
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
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<style>
th {
color: #fff;
}
</style>
<table class="table table-striped">
<tr class="bg-info">
<th>Name</th>
<th>Age</th>
<th>Birthday</th>
</tr>
<tbody id="myTable">
</tbody>
</table>
<script>
// var CityData = require("./CityMetrics.json");
// // var CityData=fetch("./CityMetrics.json")
// console.log(CityData)
import * as data from './CityMetrics.json';
// const { name } = data
// buildTable(myArray)
// function buildTable(data) {
// var table = document.getElementById('myTable')
// for (var i = 0; i < data.length; i++) {
// var row = `<tr>
// <td>${data[i].name}</td>
// <td>${data[i].age}</td>
// <td>${data[i].birthdate}</td>
// </tr>`
// table.innerHTML += row
// }
// }
</script>