22 lines
700 B
JavaScript
22 lines
700 B
JavaScript
|
|
|
|
async function getFiliere(search){
|
|
try {
|
|
let xhr=new XMLHttpRequest();
|
|
xhr.open("get", `https://data.enseignementsup-recherche.gouv.fr/api/records/1.0/search/?dataset=fr-esr-parcoursup&sort=tri&facet=fili&timezone=Europe%2FBerlin&q=${search}`);
|
|
xhr.responseType = "json";
|
|
|
|
xhr.onload=() =>{
|
|
if(xhr.status == 200){
|
|
resolbe(xhr.response)
|
|
}else{
|
|
PromiseRejectionEvent(xhr.statusText)
|
|
}
|
|
}
|
|
|
|
xhr.onerror= () => PromiseRejectionEvent("Erreur Reseau");
|
|
return xhr.send();
|
|
} catch (error){}
|
|
return null;
|
|
}
|