I am quite new to javascript and am currently finding a way to manage a high score system for a simple online game. The original plan was just to store the updated vars onto a server and retrieving them upon request eg
var score = 0;
var level = 0;
//javascript game code to update score and level
//code to store vars into database
Upon some research however it seems that it is not recommended for javascript to directly communicate with the server-side and should instead communicate via some sort of server-side scripting language (eg PHP), which can probably be done so using a form.
Now I'm pretty confused as to what I should do, as all I want to do is to store some variables which are already created without having to create a form. I have also thought about saving the variables to a text file, but that does not seem to be a solution ideal for an online score system.
To top it all off many other keywords started springing up (eg AJAX, jQuery, nodeJS, JSON, parse... to name a few) which I'm not too sure if they're relevant to my current problem.
What is the simplest way to go about doing this (storing variables online to be retrieved upon request)?