Michael Schrenk
  Home     Strategies     Webbots     Publications     Defcon     WebDev     Blogs     Contact  
The online experience of the mid-'90s was very different from what we enjoy today. Watching web pages slowly render over a 28.8 modem connection defined the Internet experience of the 20th century. Faster network connections and a technology called AJAX (Asynchronous JavaScript and XML) freed web surfers from having to wait for the next web page. The result is a fast, responsive and highly interactive online experience that didn't exist 15 years ago. Excerpt from " Webbots, Spiders, & Screen Scrapers, 2nd Edition " (2012, No Starch Press, San Francisco)

How do I decide when to use AJAX?

AJAX has enjoyed increasing popularity among web developers. But like most technologies, it's best to weigh the advantages and take the route that creates the optimal user experience .

What is AJAX?

AJAX —also known as, Asynchronous JavaScript and XML , has been around in one form or another since 1995. First appearing in Internet Explorer 5, Microsoft created an ActiveX control that facilitated something called XMLHTTP. This was well before the term AJAX existed. This ability, along with DHTML, allowed developers to create web pages that accessed and displayed information without the need to refresh the web page. In 2006, the W3C established the standard we now know as AJAX. Soon AJAX found wide browser support. .

Arguments for using AJAX

While this article is someone cold on AJAX, there are instances where this technology enhances the user experience.

Using AJAX to manage the size of web pages

There are many times, especially when a data exists in tabular form, where supplemental data is useful to the viewer, but not to every viewer. In those cases, AJAX can improve the user experience for those, who desire additional information, while not affecting the user experience, for those who don't. For example, suppose a web page displays the district-by-district election results for your state. As you cursor over each district, a complete description of the voting results is displayed, including exhaustive details on voting patterns, demographics, etc. This information could have been downloaded with the initial page flow, but at the cost of a larger initial download. Considering that not every viewer will want this information, it could be argued that it is better to download the election details as needed with AJAX.

Using AJAX to create context sensitive controls

Another very effective use of AJAX is where a series of form controls are dependent on previous selections. In this case, imagine a form that needs to capture Country and City information in select list controls. The first select list contains a list of countries. On selection of the country, the second control uses an AJAX function to request the list of cities for the selected country, and dynamically assembles a relevant list of cities for only that country in the second select list. This could, again, be done without the use of AJAX, but all possible combinations of country-state select lists would need to be part of the initial download.

The case against AJAX

While not requiring a new page flow can be seen as an advantage, not requiring new page downloads and subsequent page flows removes much browser functionality.

AJAX can kill bookmarking

When AJAX is responsible for massive content changes that otherwise would be done with traditional navigation, you loose the ablity to bookmark (or share a link to) the page. In short, the user experience will be diminished if the URL doesn't define the content of teh web page.

AJAX may disable the browser back key

Web surfers rely on the utility and dependability of the the browser's back button, or the ability to revert to the previous page by “clicking back”. When the content is controlled by AJAX, the back button becomes useless and the user experience is compromised.

AJAX challenges Search Engine Optimization

Modern search engines rank pages , or decide how relevant your content is, by examining the content. If the content is dependent on user interaction and is downloaded well after the initial page, the only thing search engines will have to identify your content are the keywords, which are losing their effectiveness in SEO.

When is data loading?

Perhaps the biggest complaint against AJAX is that is it often not well implemented, and it is next to impossible to tell when your browser is hung up, or when it is simply waiting for an AJAX download to complete. This is because the familiar animated browser download icon doesn't respond to AJAX commands.

Conclusions

Today every web developer must know how to use AJAX. And ultimately, you need to decide when--or if--AJAX is the solution to your design challenges . My advice is to always remember that the user experience should dictate the technology you use.


--Michael Schrenk
September 11, 2013
Las Vegas Nevada

Comment
Enter this number 152398 Here =>
Your name
Word!
Anonymous ,    Nov 12, 2013 11:24PM
 
Twitter is a good example of this. The first set of tweets is downloaded with the page, the rest are gotten with AJAX and are not visible when you do a view page source.
Anonymous ,    Sep 13, 2013 12:51AM
 
<- Back to blogs.

Contact

Contact Schrenk

NOTE: Any third-party images used on this website belong to their respective owners.

Get Updates

The Best Words with Friends Mobile Cheat
US Time Zone Cheat
Copyright © 2024. All rights reserved