-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
82 lines (72 loc) · 2.04 KB
/
index.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Universities in Pakistan </title>
<style>
table,
th,
td {
text-align: center;
color: rgb(51, 46, 46);
border: 1px solid rgb(198, 44, 44);
}
table thead tr th,
table tfoot tr th {
color: rgb(233, 18, 18);
}
</style>
</head>
<body>
<h3>All Universities of Pakistan</h3>
<table style="width:100%">
<thead>
<tr>
<th>Sr no</th>
<th>Country</th>
<th>State province</th>
<th>University Name</th>
<th>Website</th>
<th>Alpha Code </th>
<th>Domains</th>
</tr>
</thead>
<tbody id="myData">
</tbody>
<tfoot>
<th>Sr no</th>
<th>Country</th>
<th>State province</th>
<th>University Name</th>
<th>Website</th>
<th>Alpha Code </th>
<th>Domains</th>
</tfoot>
</table>
</body>
<script>
getData();
debugger;
async function getData() {
let resource = await fetch("http://universities.hipolabs.com/search?country=Pakistan");
let data = await resource.json();
let myHtml = '';
for (let i = 0; i < data.length; i++) {
myHtml += `
<tr>
<td>${i+1}</td>
<td>${data[i].country}</td>
<td>${data[i]['state-province']}</td>
<td>${data[i].name}</td>
<td><a href="${data[i]['web_pages']}">${data[i]['web_pages']}</a></td>
<td>${data[i]['alpha_two_code']}</td>
<td>${data[i].domains}</td>
</tr>
`;
document.getElementById('myData').innerHTML = myHtml;
}
}
</script>
</html>