cerated by using vanilla javascript.
API using XMLHTTPRequest.
project is fully customizable :)
you just need to change the API based on your need ^.^
// function to get API vaulues
function httpRequest()
{
var http=new XMLHttpRequest();
http.open('GET', 'http://5d76bf96515d1a0014085cf9.mockapi.io/quiz',true);
http.send();
return http;
}
No need to worry about understanding of the code.
Comments are included for each and every line.
// function to process the received RESPONSE
function httpResponse()
{
var http=httpRequest();
http.onreadystatechange=function state()
{
// check the readystate i.e response received
if(this.readyState==4)
{
var responseArray=JSON.parse(this.responseText);
// pass responseArray to function(create HTML elements)
newElement(responseArray);
}
// check for the status 429 (Too many responses)
else if(this.status==429)
{
alert("Too many requests!!!");
window.location.reload();
}
else{
console.log(this.status)
}
}
}
with animation included.