How To Use AJAX
Introduction
AJAX, an acronym for Asynchronous JavaScript and XML, is the latest technology buzzword. Asynchronous means that you can make a request to a server via Hypertext Transfer Protocol (HTTP) and continue to process other data while waiting for the response. This means, for example, that you can make calls to a server-side script to retrieve data from a database as XML, send data to a server-side script to be stored in a database, or simply load an XML file to populate pages of your Web site without refreshing the page. However, along with all of the benefits, AJAX sparks some unquestionable debate over issues with the Back button. This article will help you to determine when AJAX is a good solution for developing your users' experiences.
I'm assuming that you have a basic understanding of the JavaScript and XML part of the acronym. Although you can request any type of text file with AJAX, I'll focus strictly on XML. I'll explain how to use AJAX in a real-world situation and how you can assess its value in a project. By the time you finish reading this article, you'll know what AJAX is as well as where, why, and how to use it. You're going to learn how to create the object, make the request, and customize the response, while maintaining good practices that provide an intuitive user experience.
I've created a sample project for this article (you can download the source code). The sample is a simple request that loads an XML file containing page content and parses the data to display it in an HTML page.