Ajax seems all jacked up. It goes against the one thing we know for sure as beginning web developers: mainly, that a page needs to load/re-load in a browser for new content to show up.
Updated your page html? Refresh.
Changed some CSS? Refresh.
Submitting form data to a database? It’s gotta go through the server, so that page either needs to submit to itself or another processing page.
In all cases, a page being displayed by a browser needs to reach out to the server to retrieve the pages of code that you, the developer, have put there.
Ajax creates a secret tunnel from the browser to the server
Something like that, anyway. Think of your website as the US and the server as Mexico. You want to get some delicious, blow-your-mind tacos al pastor but it’s really annoying having to go through the hassle of customs and dealing with border patrol. It’s really disruptive to your taco enjoyment, just like a page reload can be disruptive to your enjoyment of a website. You want your tacos without hassle so you build a tunnel under the border. I request tacos through the tunnel, the tacos come back to me through the tunnel. Now tacos come and go without without having to wait at customs (browser refresh), nobody at the border is any the wiser and everyone gets what they want without delay. (I really want to eat some tacos right now.)
Here’s the key
I’m no expert in this by any means. It’s just that Ajax has seemed like some kind of voodoo magic to me for years until I just found a tutorial and tried it out. Now, it kind of makes sense to me how it works. There’s still plenty more to learn, but it’s exciting when the curtain is pulled back and I can comprehend what I find behind it.