I'm trying to insert the value of a variable in a database. The project is done entirely in javascript but I need to use php to insert the information in the database.
I have a variable called Score that only indicates the sum of the user's points, it is defined according to a condition.
if(lineCount == corretoBloco){
          var text = BlocklyGames.getMsg('Games_linesOfCode2');
          var medalhaWin = document.getElementById('medalhaWin');
          medalhaWin.innerHTML = 'Ouro';
          window.score = 3;
        }else{
          var text = BlocklyGames.getMsg('Games_linesOfCode2');
          var medalhaWin = document.getElementById('medalhaWin');
          medalhaWin.innerHTML = 'Prata';
          window.score = 2;
        }
This variable is only called case == finish.
case 'finish':
       Maze.scheduleFinish (true);
       BlocklyDialogs.congratulations ();
   }
I need to make case finish, call a function in php that inserts the values of this variable in the database.
 
    