The web used to be synchronous – this means that one thing happened after another. If you wanted to search, you’d type in your term and hit “Search” and wait around for results. You’d hit “refresh” on Twitter (which wasn’t around back then) waiting to see if your friends posted any updates.
These days, though, web pages can change asynchronously – without waiting for you to do anything. New tweets will load, new Google results will show up, all without refreshing or going to a whole new page.
When Google suggests searches as you type, that’s AJAX. Your browser takes what you’ve started typing – maybe “ski” – and sends it over to the server. The server runs through a database to see what people searched for that starts with “ski.” The server sends a list of terms back and voilà! Your browser pops them into an list right under where you’re typing. And you didn’t have to do anything, so it’s asynchronous.
OK, so that’s how the A in AJAX works, but what about the rest?
The last letter – X – stands for XML. Think of XML as an envelope that you can put data in. The first forms of AJAX sent XML back and forth to the server to talk. Whether it was finding tweets or search results, everything was wrapped in tiny XML packages. Some XML containing tweets might look something like this:
<text>Hey everyone, we're learning about XML!</text>
<text>Hey everyone, we're learning about APIs!</text>
Although it has a lot of really different pieces, AJAX boils down to allowing your browser to get information from a web server (or Google or Twitter or Facebook or whomever) without you needing to click links or refresh the page. It just makes the web a more useable place.
Cocktail Party Fact