Unless you’ve spent the past couple of years down a rabbit hole, you’ve already heard about AJAX: it’s a technique that combines asynchronous client-server communication with a set of existing toolkits (JavaScript, CSS, the DOM) to selectively update parts of a Web page, instead of the traditional “full page reload”. This produces applications that are quicker and more responsive to user input, resulting in a better user experience.
But what does all this have to do with PHP, you ask? Well, PHP is commonly used on the server end of the connection, to handle AJAX requests and send back responses. But that isn’t all it can do – with a little PEAR package called HTML_AJAX, you can use PHP to significantly simplify the work that goes into building and deploying an AJAX application.
That’s where this article comes in. Over the next few pages, I’m going to give you a quick run-down on the PEAR HTML_AJAX class, together with a few examples of how you can use it to AJAX-ify various Web applications. Keep reading, and be prepared to be amazed!