Shortcut: Ajax with PHP 5


We take Ajax for granted but when this eBook was written over seven years ago when Ajax was still struggling for adoption. While Ajax has been around in one form or another since 2000 it wasn't until the year leading up to this book that it was starting to become mainstream.

To put this in perpective, jQuery was released less than nine months before this book. Prototype was slightly more mature having been released in 2005. As such I opted for this book to only include the raw Javascript necessary to do Ajax requests rather than using one of the libraries out there. Which was completely reasonable in 2007. Given time I probably would have added full chapters to the end on each of those.

This book may still be useful for learning the ins and outs of Ajax itself. However, as a reviewer pointed out in 2011 (four years after release) most of what is covered in this eBook is now pretty heavily abstracted into third-party libraries.

One interesting point is the focus on graceful degradation. That is, if the browser does not support Ajax the app should still behave properly. That is one of the key concepts that we have, perhaps regrettably, lost in recent years as we continually strive to use the latest and greatest technology.

You may also notice a few other interesting choices like refering to XML and Json as markup languages (now I would probably call them data encoding formats) and the appendix which contains notes on how to make the examples work in PHP 4 (which was still quite common in 2007).


"Ajax with PHP 5" is a detailed overview of how to use PHP technologies to create interactive, fault-tolerant, and responsiveweb applications.

This Short Cut first concentrates on the fundamentals of Ajax. Then it covers serving (or providing) content formattedin both XML and JSON.

Finally, we completely immerse ourselves in the Ajax world and write two PHP applications that use each markuplanguage on both the client and server.

We encourage you to use the classes and examples given to produce your own rich Web 2.0-style applications.

Table of Contents

  1. PHP with Ajax
  2. The "Hello World" of Ajax and PHP
  3. The Example Give
  4. Serving XML
  5. Serving JSON
  6. Consuming XML
  7. Consuming JSON
  8. Some Closing Notes
  9. Appendix: PHP 4 vs PHP 5
O'Reilly Media
May 2007
Safari Books Online, ePub, mobi, PDF