Most people in an industrialized nation have heard of Ajax. It’s a powerful household cleaner that was released in 1947 by Colgate-Palmolive. Of course, that is not the point of the article. No, the Ajax we are referring to has to do with the Internet. You may have heard the term from a friend or seen more mentions of it on the Web. You may be thinking to yourself, “I want my website built in Ajax!” Let’s dispel some misconceptions of what Ajax is and try to better explain it.
What does it stand for?
First, Ajax is actually an acronym. It stands for Asynchronous Javascript and XML (if you are trying to understand the Web, be ready for lots of acronyms). Second, Ajax isn’t a programming language, but rather a programming concept. You may have heard of such programming languages as PHP or Visual Basic (does anyone remember Cobol?). Ajax is simply a way for a programmer to use their programming language.
What is it?
So let’s get into it. What exactly is Ajax? It’s a way for a website to update certain parts of a webpage dynamically without having to reload the whole page. An example of what I mean would be when you fill out a form on a website and click the ‘submit’ button. Your browser’s little “thinking” icon spins and the webpage goes blank for a second and then displays a new page with different information. With Ajax, your screen doesn’t go blank and your browser doesn’t have to think. New information is just displayed.
Let’s take a step back for a second and set the stage. All websites consist of a server and a client. The server is the computer located somewhere in the world that has the website physically saved on its hard drive. The client is your computer and your computer’s web browser. When you visit a website, the server sends the information to your computer, and then your browser displays that information in a nice, pretty fashion. When you submit a form, the information in that form is sent back to the server, the server does with that information whatever it’s supposed to do, then sends an appropriate response back to your computer. Again, your browser displays that response. Whenever your browser talks directly with a server, you get that little spinning “thinking” icon, and eventually, your webpage reloads with new info.
Another thing to make note of is a server and a client each has their own web-based programming languages. Among others, a server-side programming language is Visual Basic and a client-side programming language is Javascript. Server-side languages control any information on the server and what information is sent to the client (your computer), and client-side languages can control any information on your browser and how that info is displayed.
This is all fine and dandy, but what if you are doing something like flipping through an online calendar or catalog? If your webpage had to reload every time you moved to the next month or next product, that would be a bit annoying, wouldn’t it? This is where Ajax comes in. With Ajax, you don’t need to reload the entire page; only the object you are interacting with gets updated.
How does it work?
So how does Ajax work? That is a big question. For the purpose of this article, I will keep it simple. Ajax is basically the use of a javascript object called “XMLHttpRequest”. This object essentially allows javascript (a client-side language) to talk with a server-side language, such as Visual Basic. The server-side language can then get whatever info is requested, such as database info, and return that to the javascript object. The javascript will then take that information and put it into some object that is currently being displayed to you. This side-steps the need of the server to reload the entire webpage.
A couple of examples of Ajax in action are:
– Spirit Mountain (http://spiritmt.com) – The Spirit Mountain Poll on the homepage.
– Cuyuna Lakes Chamber of Commerce (http://cuyunalakes.com) – The Calendar of Events on the homepage.
As I had mentioned, I want to keep this article simple. There is a lot more to Ajax than this. If you are interested in more details, there are many resources available on the Internet.
Fun Facts
– Ajax isn’t new. It’s actually been around since 1995.
– The asynchronous object (such as the XMLHttpRequest Object) was adopted by all major web browsers in 1999.
– The term ‘Ajax’ was coined in 2005.
– Gmail and Google Maps are based much on Ajax.
– Cobol was originally introduced in 1959 and is still in use today. The latest release was in 2002 and a new release is due out soon.