Skip to content

Commit 4fd6be8

Browse files
authored
Update index.html
1 parent 7cbb6d2 commit 4fd6be8

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

homework/index.html

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,28 @@
1616
</head>
1717

1818
<body>
19-
<div id="root"></div>
20-
<script src="./index.js"></script>
19+
<div id="root"></div><header><p>HYF Repository</p></header>
20+
<select id="select"> </select>
21+
</div>
22+
<div id="container">
23+
<div id="left-div"><table id="left-table"></table></div>
24+
<div id="right-div"><table id="right-table"></table></div>
25+
</div>
26+
<script>
27+
const xhttp = new XMLHttpRequest();
28+
xhttp.onreadystatechange = function() {
29+
if (this.readyState == 4 && this.status == 200) {
30+
const data = JSON.parse(this.responseText);
31+
const select = document.getElementById('select');
32+
select.innerHTML = data
33+
.map((opt, i) => `<option value="${i}">${data[i].name}</option>`)
34+
.join('');
35+
36+
xhttp.open('GET', 'https://api.github.com/orgs/HackYourFuture/repos?per_page=100', true);
37+
xhttp.send();
38+
}
39+
};
40+
</script>
2141
</body>
2242

23-
</html>
43+
</html>

0 commit comments

Comments
 (0)