In this article we explain what AJAX is, when it should be used and what contraindications it has. We also show how to overcome some of the contraindications.
What is AJAX?
The acronym AJAX stands for: Asynchronous JavaScript And XML. That is, the combination of JavaScript and XML asynchronously.
It is a technique developed for interactive Web applications, which consists of making a set of three existing technologies work together effectively.
These technologies are:
- (X)HTML and CSS (Cascading Style Sheets), to provide structure and present information on the web page.
- JavaScript, used for dynamic interaction with data.
- XML, used for interaction with the web server. However, it is not always necessary to use XML with AJAX applications, since, for example, plain text files can also store information.
Like DHTML, AJAX is not a stand-alone web technology, but rather an umbrella term for all three of the above technologies.
What is Ajax for?
Ajax is used to make changes to a web page, at the user's discretion, without having to reload the entire page again.
For example, on a website the user requests some information that is offered from the same website (such as viewing a product description) and when clicking on the link, the requested information appears on the same page (without loading it again).
The process of displaying the data in HTML would consume a lot of bandwidth, since the entire HTML would have to be reloaded just to display the changes made. However, with an AJAX application it is much faster and does not consume bandwidth.
The JavaScript used in AJAX application is a dynamic language, capable of making changes to a web page without reloading it. AJAX ensures that only the necessary information is requested and processed, using SOAP or another web services language loosely based on XML.
Hence, on a technical level, three advantages are obtained: a much shorter loading time, savings in user bandwidth and a much lower load on the server where the website is hosted.
AJAX problems
Problems with search engine indexing:
AJAX is used by Google, Yahoo, Amazon and countless other search engines, portals and content creators, but they do not use it as widely and massively as some people think. Google, for example, which supports webmasters using AJAX in their programming, uses it itself in GMail, Google Suggest, Google Maps, but not on absolutely all of its web pages.
The problem with AJAX is that the content displayed within the application that uses AJAX is not indexed by search engines. This is because search engine spiders are not able to interact with the AJAX application and get the command that displays the content to be activated.
That is why it is a bad idea, for example, to create a list with the names of our products and use an AJAX application to display the product description and its photograph to the right of the list when clicking on a product name. If we do this, the product descriptions and their images will not be indexed in Google or any other search engine.
Although it's not all bad news, certain ways of working with AJAX do index, for example, those that play with showing or not showing content using positive and negative margins. So we just have to take into account when programming whether the spiders will be able to pass or not.
Accessibility issues:
If we start from the basis that our web pages should always be accessible to all types of browsers and users and should at least comply with standard A of the W3C (http://www.w3.org), we find that most scripts that improve the appearance and interactivity of a web page have accessibility problems. AJAX also has them.
As we have seen at the beginning of this article, the use of AJAX implies the use of JavaScript, and some browsers do not support this type of programming. Although, as we will see later, this has a solution.
But we must bear in mind that a large part of the AJAX applications that we will find in the libraries that exist on the Internet have not solved this problem and therefore, they are applications that do not comply with the W3C standards (at the end of these lines we offer links to code libraries and articles that deal with the subject of accessibility and AJAX).
AJAX, to be used sparingly
As we have seen in the previous section, although AJAX applications provide dynamism, interactivity and bandwidth reduction to a web page, they also have drawbacks at the level of indexing in search engines and accessibility. Therefore, we must take into account and neutralize the following:
- If we use AJAX on our web pages, we must be aware that the content displayed within the AJAX application will not be indexed by search engines. To overcome this, we can create this content redundantly and make it accessible to spiders through a sitemap or through links in the footer of the website.
- If we use AJAX to make our page more interactive, we must keep in mind that we will not meet accessibility level A, unless we use code libraries approved by the W3C or means to navigate the web without using JavaScript.
Related links
New information about AJAX indexing in Google (March 2010): http://code.google.com/intl/es/web/ajaxcrawling/
Examples of web pages that use AJAX and AJAX code libraries for use by webmasters:
http://ajaxpatterns.org/Ajax_Examples
Articles explaining how to get AJAX code that does comply with W3C accessibility level A:
http://www.maxkiesler.com/
List of common accessibility errors:
http://www.w3.org/TR/WCAG20-SCRIPT-TECHS/#N11799



