Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

174
Visualizações
How I can fetch the API to display the question

I have started learning about fetch API for few days and my teacher asked me to do it immediately. He said the request for the data is none. and it response that when created successfully, the status is 201 and the new created attempt contains attempt ID and an array of questions in Data(Json). I tried to code but it not works. This is the link of the API: https://wpr-quiz-api.herokuapp.com/attempts

All the description is here. https://wpr-quiz-api.herokuapp.com/

Sorry about my bad English and the code is not so good because I just start learning it. So if you don't mind, please describe as detailed as possible.

Thank you so much

let question=[];
const inputk = document.querySelector('span');
  question.push(inputk.value);
function onResponse(response){
  return response.json();
}
function onsubmit(object){
  const inputk = document.querySelector('span');
 question=object;
}
  fetch("https://wpr-quiz-api.herokuapp.com/attempts")
  .then(onResponse).then(onsubmit)
<form action="https://wpr-quiz-api.herokuapp.com/attempts" method="POST">
  <div>
    <span></span>
  <input type="radio">
    <label>Option 1</label><br>
   <input type="radio">
    <label>Option 2</label><br>
    <input type="radio">
    <label>Option 3</label><br>
  </div>
</form>

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda