Much like the Greek Hero, Ajax or Asynchronous JavaScript and XML as sometimes it is known is a peculiar type of web programming that has completely swept the Internet and web masters like a hammer. More and more websites, even remotely dealing with things that are “about the Internet”, have written about or have actually been acquainted with Ajax in one-way or the other. Google uses it, so does Microsoft, yahoo and amazon.com, amongst others.
Asynchronous JavaScript and XML or Most commonly known as Ajax, as mentioned above is a kind of web programming methodology that’s gaining grounds on the internet by leaps and bounds. Jesse James Garret, from Adaptive Path, coined the term “Ajax”. You should take note that Ajax, is NOT an Acronym in any way or kind for Asynchronous JavaScript and XML, both are just two different names for the same thing.
Generally any interactivity built within a website requires that the entire webpage be returned from the server. For e.g. a drop down box selection made by a user on a webpage built and based on the principles of multiple drop down boxes, would require that the client browser send the entire web page to the browser. The server on the other hand would “check and validate” the request and then return another webpage as per the request made by the client browser. This is true for all clicks, form submissions and the likes.
Phew! This is a long process and users/visitors of such websites have to wait for a reply from the web server. The use of Ajax on such web pages or websites would comprehensively reduce the server overhead and would request the server only to return the part that is required or requested by the client browser or visitor of the web page or web site.
It’s a myth, that Ajax is something new. Ajax has been around for quite some time now and is becoming more mature that it already is and with age comes wisdom. And with wisdom comes knowledge, and thus we would have wonderful Ajax-ian javascript libraries like Prototype, Script.aculo.us, mootools, Google’s widget toolkit and YUI to name just a few.
Flickr, Twitter, Orkut, MySpace, Hotmail, you name it and these guys have used Ajax. For e.g. if you use Gmail, you would have used or come across the chat module built within the gmail interface. The module works on Ajax.
Almost all browsers today have an object built into them, which is known as the XMLHttpRequest object. If you were a strong follower of abbreviatia, you would call this object as XHR. This object is what makes up most of Ajax programming possible. With the help of this object, it is possible to write javascript that gets executed within the browser and requests data from the server, without having to reload the web page.
Albeit, both Ajax and XMLHttpRequest or XRH both were made keeping in mind XML and both do use XML, the data requested and delivered using these JavaScripts, need not be XML based, it can be almost anything.
Ajax, being accepted so widely has definitely made more options available like the introduction of various javascript libraries, viz – Prototype, Moo Tools and jQuery to name a few. More data formats to work with using Ajax becoming widely standardized like the JSON also known as the JavaScript Object Notation data format.
The entire domain of Ajax consists of CSS, XHTML, DOM, XML, XSLT, XHR or the XMLHttpRequest object, and finally JavaScript which acts as a binder for all these technologies and makes magic happen. Where XML, XSLT are concerned, they are not required because most data exchanged is not XML based, hence the JSON object.
So, essentially with the help of Ajax, we can built web applications and web sites, which have a “rich” user experience to offer, without taking much of the users / visitors time or without making such users wait. Ajax, most certainly promises a much smoother, faster, and definitely richer user experience.
Ajax has had a very big following for quite some time now and what a following it is with Google, Yahoo and Microsoft using and standardizing Ajax. But Ajax also has its downfalls. For e.g. if a user visits a site via a browser that does not support the XHR or Ajax, the user’s experience would definitely be marred and the user might have to wait for more time as compared to normal web pages that don’t use Ajax. Pages created using Ajax can not get registered in the browsers history. Once cannot bookmark such pages too. Ajax cannot be used for cross server scripting, since it uses JavaScript as a binder, and JavaScript follows the same domain policy also known as the same origin policy. Ajax, is still nascent where security dimensions are concerned and would pose a threat where hackers are concerned.
Well for one Ajax makes for an amazing user experience, don’t you like the idea you can chat and read and send emails using the same window(Gmail)? It also makes the user experience faster. There are many graphic effects and dynamic controls that make web pages and web sites more “Richer” where such user experience is concerned. Plus, if you are planning to learn and incorporate Ajax within your own websites, the best way to go would be downloading pre-compiled javascript libraries which let you do a lot more in just about three lines of code.
The point of it all being, that Ajax is here and here to stay! And since almost the entire existence of web sites today revolves around “user experience”, the most important aspect when web programming is to keep this “user experience” in mind.
Some of the crème-de-la-crème of Ajax-ian Resources are mentioned below.
Dojo@ dojotoolkit.com
Prototype@ prototype.conio.net
jQuery@ jQuery.com
Moo.fx@ moofx.madformilk.net
The best place to find all updated resources on Ajax, would be http://ajaxian.com/resources
For Beginner’s the best place to start would be http://www.w3schools.com/Ajax/Default.Asp. www.tizag.com/ajaxTutorial/ is also a great place to start you Ajax quest!
Do have a look at www.ajaxtutorial.net/ and www.ajax-tutorials.com/ .
Have a good one.