From 5fdf339a29c197eda77a3b365fb60a705f85b74d Mon Sep 17 00:00:00 2001 From: Vincent Ramiere Date: Tue, 19 Oct 2021 12:15:09 +0200 Subject: [PATCH] modif films js --- scripts/films.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/scripts/films.js b/scripts/films.js index e69de29..e197e91 100644 --- a/scripts/films.js +++ b/scripts/films.js @@ -0,0 +1,27 @@ +const FILMS = document.getElementById('container'); +const API_URL = "https://swapi.dev/api/films"; + + +fetch(API_URL) +.then((reponse) => { + //console.log(reponse); + return reponse.json() +}) +.then(reponseFormat => { + for(let index = 0; index <6; index++){ + //console.log(reponseFormat.results[index]); + const data = reponseFormat.results[index]; + console.log(data); + + FILMS.innerHTML +=` +

${data.title}

+

${data.episode_id}

+

${data.opening_crawl}

+

${data.director}

+

${data.producer}

+

${data.release_date}

+

${data.starships}

+

${data.starships}

+
` +} +}) \ No newline at end of file