What is Ajax and How is it Used?

by in Uncategorized

When you think of Ajax, there’s a good chance cleaning detergent comes to mind, but in the world of Web Development, Ajax stands for Asynchronous JavaScript and XML.

Ajax is s a technique (actually, several techniques,) for creating fast and dynamic web pages using existing web standards. Ajax includes:

XMLHttpRequest object (to exchange data asynchronously with a server)
JavaScript/DOM (to display/interact with the information)
CSS (to style the data)
XML (often used as the format for transferring data)

Basically, here is how it works -  When using a Web-based application, a user must enter information to be submitted to a server, and wait for the page to refresh or redirect the response from the server.  With Ajax, server requests are made in the background, and information is returned without any waiting on the part of the user.  If you’re not a web guru, you can think of this kind of like filling out a form – you enter the data, submit it and have results presented to you without any page refreshes. While all this might sounds as win-win situation there are several drawbacks of using Ajax versus regular HTML pages:

  • Pages dynamically created using successive Ajax requests do not automatically register themselves with the browser’s history engine, so clicking the browser’s “back” button may not return the browser to an earlier state.
  • Because most Web Crawlers do not execute JavaScript code, AJAX pages can’t properly accessed and indexed in Search Engines.
  • It’s difficult to bookmark a particular Ajax page since it’s dynamically loaded.

As you can see there are quite a few implications with utilizing Ajax across all pages on the website. That being said, I would recommend Ajax technique for specific needs, such as pages that require Data entry and processing (Registrations & Subscriptions,) Auto-Completer, Instant Editing, Dynamic Navigation Menus or Instant Data Validation.