EduWireApps / ecoledirecte-api-docs

71 stars 15 forks source link

250 QCM #36

Open lol-linux opened 1 month ago

lol-linux commented 1 month ago

I would like to know how I can modify my code so that it displays the QCM and allows me to respond. Thank you in advance.

`

<!DOCTYPE html>

Test de Connexion EcoleDirecte
Chargement...

`

M6a5x98 commented 1 month ago

When the script reaches the point where it detects data.code === 250 fetch the qcm endpoint and create a form on the page with all responses decoded from base 64. In .then(serverResponse) callback function after fetch :

let question = serverResponse.data.question;
let reponses = [];
serverResponse.data.propositions.forEach(proposition => {
     reponses.push(atob(proposition))
})
//Create a <form> element with all datas