essai
This commit is contained in:
parent
4a95ab8ced
commit
b670aad827
2 changed files with 13 additions and 9 deletions
|
@ -23,7 +23,7 @@
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="recherche">
|
<section id="recherche">
|
||||||
<form action="" id="formRecherche" onSubmit="envoiForm(event); console.log('click')">
|
<form action="" id="formRecherche" onSubmit="event.preventDefault(); console.log('click')">
|
||||||
<label for="textRecherche">Recherche : </label>
|
<label for="textRecherche">Recherche : </label>
|
||||||
<input type="text" name="textRecherche" id="textRecherche">
|
<input type="text" name="textRecherche" id="textRecherche">
|
||||||
<input type="submit" value="ok">
|
<input type="submit" value="ok">
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { api_call } from './util';
|
import { api_call } from './util';
|
||||||
|
|
||||||
const films = document.getElementById("resultats");
|
const films = document.getElementById("resultats");
|
||||||
const search = document.getElementById('recherche');
|
const search = document.getElementById('formRecherche');
|
||||||
|
|
||||||
const API_SEARCH = "https://swapi.dev/api/films/?search"
|
const API_SEARCH = "https://swapi.dev/api/films/?search"
|
||||||
const API_URL = "https://swapi.dev/api/films/"; // déclare la localisation de la liste des films
|
const API_URL = "https://swapi.dev/api/films/"; // déclare la localisation de la liste des films
|
||||||
|
@ -25,19 +25,23 @@ function remplissage(EPISODES) {
|
||||||
}
|
}
|
||||||
const accordeonItemHeader = document.querySelectorAll(".accordeon_item_header");
|
const accordeonItemHeader = document.querySelectorAll(".accordeon_item_header");
|
||||||
accordeonItemHeader.forEach(accordeonItemHeader => {
|
accordeonItemHeader.forEach(accordeonItemHeader => {
|
||||||
accordeonItemHeader.addEventListener("click", event => {
|
accordeonItemHeader.addEventListener("click", event => {
|
||||||
accordeonItemHeader.classList.toggle("active");
|
accordeonItemHeader.classList.toggle("active");
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function envoiForm(event){
|
search.addEventListener("submit", ()=> {
|
||||||
|
function envoiForm(event){
|
||||||
|
console.log(search.value);
|
||||||
|
api_call(API_SEARCH+search.value, remplissage)
|
||||||
|
console.log(formenvoyé);
|
||||||
|
|
||||||
event.preventDefault();
|
|
||||||
api_call(API_SEARCH+search, remplissage)
|
|
||||||
console.log(formenvoyé);
|
}
|
||||||
|
|
||||||
}
|
})
|
||||||
|
|
||||||
|
|
||||||
api_call(API_URL, remplissage);
|
api_call(API_URL, remplissage);
|
||||||
|
|
Loading…
Add table
Reference in a new issue