appel API
This commit is contained in:
parent
b929d131b8
commit
484c098937
2 changed files with 37 additions and 7213 deletions
7222
package-lock.json
generated
7222
package-lock.json
generated
File diff suppressed because it is too large
Load diff
28
scripts/personnages.js
Normal file
28
scripts/personnages.js
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import { api_call } from "./util";
|
||||||
|
|
||||||
|
const personnages = document.getElementById("resultats");
|
||||||
|
|
||||||
|
console.log('personnage.js loaded');
|
||||||
|
|
||||||
|
api_call("people", console.log);
|
||||||
|
|
||||||
|
|
||||||
|
function remplissage(json){
|
||||||
|
console.log(json.results[0]);
|
||||||
|
|
||||||
|
api_call("planets/1", (response) => {
|
||||||
|
console.log(response);
|
||||||
|
});
|
||||||
|
|
||||||
|
personnages.innerHTML =
|
||||||
|
`<section class="resultat">
|
||||||
|
<h1 class="titreAccordeon"></h1>
|
||||||
|
<div class="accordeon">
|
||||||
|
<div class="1"> 1</div>
|
||||||
|
<div class="2"> 2</div>
|
||||||
|
<div class="3"> 3</div>
|
||||||
|
</div>
|
||||||
|
</section>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
api_call("planets", remplissage);
|
Loading…
Add table
Reference in a new issue