Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

175
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!