samedi 17 avril 2021

Quiz website - save data (scores) generated in javascript function in database with node.js [closed]

I have a quiz website built in html, css and javascript were the scores made in each question are being saved in localStorage but it's needed to save in a database instead (I'm trying to use node.js). I already have the line code were the score is verified and saved in localStorage:

//beggining of javascript code

levQuantity = localStorage.setItem("levQuantity",3); 
levQuantity = parseInt(localStorage.getItem("levQuantity"));

for(lev = 1; lev<= levQuantity ; lev++){
    
    var score = localStorage.getItem("percent_" + lev);
    var nextLev = lev + 1;
  //variable that verifies the score
  var score = parseInt(localStorage.getItem('score_' + lev));

Can you please provide a way to save this scores data into a database trough node.js (I have setup the node.js and have the dabatase file created so it is just waiting to receive the scores values).

Thank you in advance for the help!




Aucun commentaire:

Enregistrer un commentaire