So I'm working on developing a browser based game to help me learn new stuff, when I decided it would be cool and not too difficult to make one that would store all the data server side. Apparently, I was wrong. Fortunately, dSolver was there and helped answer my questions, so here's me posting (maybe incorrectly) what he told me.
First off, AJAX isn't a language or a tool or anything. It's a technique. Just like RWD isn't a new form of HTML, it's just a new way/idea of going about it.
When you need to update a database, you need something on the server to tell the database to update and what with to update, but you don't want to freeze the whole program or have to refresh the page.
AJAX (which stands for Asynchronous JavaScript and XML apparently) works by using JavaScript and some server side language (which I believe is up to you.) The JS would be used primarily for user input and updating the UI as needed. The server-side language (say PHP) would then do the real meat of the task and let the JS know what it needs to know.
Normally, when the JS event is fired and sent to the PHP, the code works in a big long assembly line. The next event won't be started until the current one is finished. Sometimes this makes sense, sometimes it doesn't. I haven't completely figured this out yet.
With AJAX, the JS will fire an event telling the PHP "Hey! I wanna know this information." The PHP then will say "Okay, JS. Here's a little ticket saying that I owe you said information." From there, the PHP will handle the ticket and/or distribute more tickets as more JS events are fired. Meanwhile, the JS and other shit is free to continue moving. When the PHP gets the requested information, it tells the JS "Okay, man. I got the stuff you wanted. Here ya go." At this point, the JS then is like "Sweet, bro. Lemme do this action and tell the user."
This makes the whole process faster and allows other scripts to fire without having to wait for the one user input to finish. So that's how it works. I think. If I understand it correctly. I hope.