essai
This commit is contained in:
parent
4a95ab8ced
commit
b670aad827
|
@ -23,7 +23,7 @@
|
|||
</section>
|
||||
|
||||
<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>
|
||||
<input type="text" name="textRecherche" id="textRecherche">
|
||||
<input type="submit" value="ok">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { api_call } from './util';
|
||||
|
||||
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_URL = "https://swapi.dev/api/films/"; // déclare la localisation de la liste des films
|
||||
|
@ -31,13 +31,17 @@ function remplissage(EPISODES) {
|
|||
})
|
||||
}
|
||||
|
||||
function envoiForm(event){
|
||||
|
||||
event.preventDefault();
|
||||
api_call(API_SEARCH+search, remplissage)
|
||||
search.addEventListener("submit", ()=> {
|
||||
function envoiForm(event){
|
||||
console.log(search.value);
|
||||
api_call(API_SEARCH+search.value, remplissage)
|
||||
console.log(formenvoyé);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
api_call(API_URL, remplissage);
|
||||
|
|
Loading…
Reference in New Issue