Before you start
Learn what to expect from this tutorial and how to get the most out of it.
With all the hype around Asynchronous JavaScript and XML (Ajax), you would think that more people would know
how it works. But all engineers seem to talk about is the XMLHttp method of getting
data to and from the server. If this method is all you know, then what you can do with Ajax is limited. In
reality, there are three ways to get data to and from the server: the XMLHttp
method, the <script> tag method, and the frame or iframe approach.
Unless you know all three of these methods (and their relative strengths and weaknesses), you won't get
the full picture. This tutorial shows you all you need to know about the critical transport piece of the
Ajax puzzle that fits between the client and the server.
In addition to understanding how the client requests data from the server, there's the question of what type of data is going across the wire. Most Ajax articles talk about Extensible Markup Language (XML), but you can actually move plain text, Hypertext Markup Language (HTML) pages, or JavaScript code. You have a lot of reasons for thinking outside the XML box.
In this tutorial, you will:
- Create the database back end for the example.
- Build a set of server-side pages that provide access to the database data.
- Build a set of pages based on
XMLHttpthat use the data services. - Build a set of pages based on iframes that use the data services.
- Build a set of pages based on
<script>tags that use the data services.
In this tutorial, you will learn the three primary methods of Ajax transport and their use in practice with PHP and JavaScript code.
This tutorial assumes a basic knowledge of XML, HTML, and the JavaScript and PHP programming languages. To run the examples in this tutorial, you need:
- A PHP server that has access to a server running MySQL.
- A Web browser. (I recommend either Mozilla Firefox or Microsoft® Internet Explorer V6.)
To run the examples in this tutorial, you will need to install the Apache Web server as well as PHP. You will also need access to a Web browser, such as Mozilla Firefox.




