Add initial implementation of Pokédex web application with HTML, CSS, JavaScript, and PHP backend

This commit is contained in:
vista-man committed 2025-03-11 13:52:23 +01:00
1 parent 2474c2527a
commit 59643b91c2
11 files changed
+443 -3

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
document.addEventListener('DOMContentLoaded', () => {
fetch('/school-pokedex/school-pokedex/api.php')
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(pokemons => {
const pokemonList = document.getElementById('pokemon-list');
pokemons.forEach(pokemon => {
const card = document.createElement('div');
card.className = 'pokemon-card';
card.innerHTML = `
<img src="${pokemon.image}" alt="${pokemon.name}">
<h3>${pokemon.name}</h3>
<p>Type: ${pokemon.type}</p>
<p>Stats: ${JSON.stringify(pokemon.stats)}</p>
<p>Info: ${pokemon.info}</p>
`;
pokemonList.appendChild(card);
});
})
.catch(error => console.error('Fetch error:', error));
});