mirror of
https://github.com/Alvin-Zilverstand/pokedex.git
synced 2026-11-25 23:53:08 +01:00
Add initial implementation of Pokédex web application with HTML, CSS, JavaScript, and PHP backend
This commit is contained in:
1 parent
2474c2527a
commit
59643b91c2
11 files changed
+443
-3
No files matched your search
@@ -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));
|
||||
});
|
||||
Reference in new issue
Block a user