Skip to content

Simple dynamic web application for quiz using XMLHTTP Request (API)

Notifications You must be signed in to change notification settings

sureandhar/Quiz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QUIZ APPLICATION

cerated by using vanilla javascript.

API using XMLHTTPRequest.

project is fully customizable :)

you just need to change the API based on your need ^.^

Usage

// function to get API vaulues
function httpRequest()
{
    var http=new XMLHttpRequest();
    http.open('GET', 'http://5d76bf96515d1a0014085cf9.mockapi.io/quiz',true);
    http.send();
    return http;
}

comment line

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)
        }
    }
}

Application preview

quiz_1 quiz_2

Alert for confirm to proceed submit

quiz_3

score page using modal box(custom dialog box)

with animation included.

quiz_4

About

Simple dynamic web application for quiz using XMLHTTP Request (API)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published