function updateMonsterStats() { // Get the selected monster from the dropdown var selectedMonster = document.getElementById("monsterDropdown").value; // Make an API request to get the stats for the selected monster fetch(`/api/monster/stats?monster=${selectedMonster}`) .then(response => response.json()) .then(data => { // Update the HTML content with the monster stats var statsContainer = document.getElementById("monsterStatsContainer"); statsContainer.innerHTML = `
Agility: ${data.Agility}
Attack: ${data.Attack}
Defense: ${data.Defense}
Experience: ${data.Experience}
Health Points: ${data["Health Points"]}
Intelligence: ${data.Intelligence}
Max Level: ${data["Max Level"]}
`; }) .catch(error => { console.error("Error fetching monster stats:", error); }); }