Optimize all modals (fetching). Implement add-player modal.

This commit is contained in:
MaxJa4
2024-01-16 20:19:40 +01:00
parent 8c4ed63359
commit fc084108ac
13 changed files with 134 additions and 91 deletions

View File

@@ -69,4 +69,24 @@ function getSelectedClan(event) {
const clanList = document.querySelector(clanListId);
return clanList.options[clanList.selectedIndex];
}
}
function loadClans() {
const homeClanList = document.getElementById('home-clan');
const oppClanList = document.getElementById('opponent-clan');
fetch('/clans_html')
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.text();
})
.then(data => {
homeClanList.innerHTML = data;
oppClanList.innerHTML = data;
})
.catch(error => {
console.error('There has been a problem with your fetch operation:', error);
});
}