2021-10-19 11:04:58 +00:00
|
|
|
const FILMS = document.getElementById('reponses-films');
|
|
|
|
const DEPLIE = document.getElementById ('deploiement-films');
|
2021-10-18 15:33:22 +00:00
|
|
|
|
2021-10-19 11:04:58 +00:00
|
|
|
console.log(FILMS);
|
|
|
|
|
|
|
|
const API_URL = "https://swapi.dev/api/films/";
|
|
|
|
fetch(API_URL)
|
|
|
|
.then((response) => {
|
|
|
|
console.log(response);
|
|
|
|
return response.json();
|
|
|
|
})
|
|
|
|
.then(afficherFilms => {
|
|
|
|
console.log(afficherFilms);
|
|
|
|
for(let index = 0; index <6; index++){
|
|
|
|
console.log(afficherFilms.results[index]);
|
|
|
|
const EPISODES = afficherFilms.results[index];
|
|
|
|
console.log(EPISODES);
|
|
|
|
|
|
|
|
FILMS.innerHTML +=`
|
|
|
|
<p class= "titre">${EPISODES.title}</p>
|
|
|
|
`
|
|
|
|
}
|
|
|
|
})
|