début tp 1b
This commit is contained in:
22
tp1b/index.html
Normal file
22
tp1b/index.html
Normal file
@@ -0,0 +1,22 @@
|
||||
<html>
|
||||
<h1>List of teams:</h1>
|
||||
<div id="teams"></div>
|
||||
|
||||
<script>
|
||||
|
||||
const teamsDiv = document.getElementById('teams');
|
||||
function fetchTeams() {
|
||||
fetch('http://127.0.0.1:9090/equipes')
|
||||
.then((response) => {
|
||||
response.json()
|
||||
.then((teams) => {
|
||||
const mmoContent = teams.equipes.map((team) =>
|
||||
`<div>${team.name} - ${team.id}</div>`
|
||||
).join('');
|
||||
teamsDiv.innerHTML = mmoContent;
|
||||
})
|
||||
}).catch(error => console.error);
|
||||
}
|
||||
fetchTeams();
|
||||
</script>
|
||||
</html>
|
Reference in New Issue
Block a user