-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
71 lines (69 loc) · 2.21 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
<!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>Currency table</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.7.1.slim.min.js" integrity="sha256-kmHvs0B+OpCW5GVHUNjv9rOmY0IvSIRcf7zGUDTDQM8=" crossorigin="anonymous"></script>
</head>
<body>
<h1>Currency Table</h1>
<table border="2">
<tr>
<th>Moeda</th>
<th>Compra (MZN)</th>
<th>Venda (MZN)</th>
</tr>
<tbody></tbody>
</table>
<script>
$(document).ready(()=>{
async function currencyData() {
const fetchedData = await fetch(
"https://www.bancomoc.mz/bmapi/exchangerates",
{
mode: 'no-cors' ,
}
)
.then((response) => {
return response.json()
})
.then((data) => {
console.log(data);
return data
});
const table = $("table body");
console.log(fetchedData, table);
for (let element in fetchedData) {
table.innerHTML += `<tr>
<td>${fetchedData[element].code}</td>
<td>${fetchedData[element].bid}</td>
<td>${fetchedData[element].ask}</td>
<tr>`;
}
}
currencyData();
})
</script>
<footer style="display: flex; flex-direction: column; margin-top: 20%">
<span>
Visite meu Linkedin
<a href="https://linkedin.com/in/Mamunhe" target="_blank"
>Clicando aqui</a
>
</span>
<span>
Ou meu Github
<a href="https://github.com/MapieMamunhe" target="_blank"
>Clicando aqui</a
>
</span>
<span style="margin-top: 5px">
Made By
<strong>Mapie Victorino Mamunhe</strong>
</span>
</footer>
</body>
</html>