-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathteams-script.js
More file actions
21 lines (20 loc) · 810 Bytes
/
Copy pathteams-script.js
File metadata and controls
21 lines (20 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
document.body.style.backgroundColor = '#49516F';
document.getElementById("getTeams").addEventListener("click", function(event) {
event.preventDefault();
const url = "https://www.balldontlie.io/api/v1/teams"
fetch(url)
.then(function(response) {
return response.json();
}).then(function(json) {
let results = "";
for (let i = 0; i < json.data.length; i++) {
results += "<div id='teamData'><p>";
results += "<h5>" + json.data[i].full_name + "</h5><br><hr>";
results += "Conference: " + json.data[i].conference + "<br>";
results += "Division: " + json.data[i].division + "<br>";
results += "Team ID: " + json.data[i].id;
results += "</p></div>";
}
document.getElementById("teamResults").innerHTML = results;
});
});