AJAX and PHP: Building Responsive Web Applications
by Cristian Darie, Bogdan Brinzarea, Filip Cherecheş-Toşa, Mihai Bucica; PACKT, February 2006

Review/buy: Amazon  ·  Amazon.ca  ·  Amazon.co.uk  ·  B&N  ·  Bookpool
Demo online: (see below)
Detailed table of contents: (see below)
Free chapter: AJAX and the Future of Web Applications
Code download: Updated June 27, 2006
Errata: Updated June 27, 2006
Book link at publisher's website: PACKT Publishing
Keywords: AJAX with PHP tutorial, AJAX PHP tools, JavaScript, DOM, XML, XMLHttpRequest, JSON, XSLT, XPath, SVG demo, PHP, MySQL, case study, AJAX whiteboard demo, AJAX grid demo, AJAX form validation demo, AJAX suggest, AJAX suggest autocomplete demo, AJAX RSS reader demo, script.aculo.us

[ PHP developer? Learn PHP Search Engine Optimization (SEO) techniques. ]

Enhance the user experience of your PHP website using AJAX with this practical and friendly tutorial! This book is the most efficient resource you can get to enter the exciting world of AJAX with PHP. Based on numerous examples and detailed case studies, this AJAX with PHP tutorial will build your foundation knowledge for creating faster, better web applications.

Get 10% discount and free shipping by ordering the book directly from Packt. There you can also find the eBook version. If you own any of my other books, contact me for a 20% discount coupon. If you own the book you can take advantage of a special web hosting discount from Nexcess: see the official announcement.

AJAX and PHP Downloads

(you can find more free PDF downloads in the Downloads section of this site)

AJAX and the Future of Web Applications (Chapter 1) is the sample chapter of the book. It's short and sweet, and hopefully it'll open your appetite for purchasing the whole book :)

AJAX Chat and JSON is a new version of the AJAX Chat case study (Chapter 5), which uses and presents JSON instead of XML. We quickly reworked the original chapter after receiving feedback from our readers, so don't be shy in case you have something to say! We really are listening. View AJAX/PHP Chat demo.

AJAX Whiteboard mini-book is an additional case study we're offering for free. It teaches you how to implement efficient client-server communications when heavy realtime communication is needed. The JavaScript/DOM drawing is interesting as well, but for a production scenario we'd recommend using another technology for drawing, such as SVG (as shown in another case study in the book). View AJAX/PHP Whiteboard demo.

Preparing Your Working Environment (Appendix A) guides you to installing and configuring Apache, PHP, MySQL, and prepare the database used in the demos. You will need this in case you'll decide to go through the Whiteboard case study.

Writing Better Code Using Smarter Tools (Appendix B) introduces you to a number of tools that can make your AJAX and PHP programming/debugging life easier.

Advanced XML: XPath and XSLT (Appendix C) quickly introduces you XSLT and XPath, as these technologies are used in some of the book's case studies.

Table of Contents and Online Demos

Chapter 1: AJAX and the Future of Web Based Development
What is AJAX, why should you care, and how does it help you build better web functionality? This short chapter is an initial incursion into the exciting world of AJAX, and takes you through the first example of the book: AJAX with PHP Quickstart (try Yoda while you're there).

Chapter 2: Client-Side Techniques with Smarter JavaScript
This chapter will guide you through the technologies you’ll use to build AJAX web clients, using JavaScript, DOM, the XMLHttpRequest object, and XML. While not being a complete tutorial for these technologies, you’ll be taken to the right track of using them together to build a solid foundation for your future applications. Each piece of theory is demonstrated using working examples, which you can check online:
Chapter 3: Server-Side Techniques with PHP and MySQL
AJAX is much about coding smarter clients, but real world applications require smart servers as well, to communicate with those clients. This chapter will teach you how to enable your server to generate dynamic output with PHP and MySQL, by going through these examples:
Chapter 4: AJAX Degradable Form Validation
Building on the theory you've learned in the first chapters, here you learn how to implement a user friendly, responsive, degradable form validation scheme. This example demonstrates implementing efficient thread-safe AJAX techniques, and works even with browser that don't support JavaScript. See the AJAX Form Validation demo.

Chapter 5: AJAX Chat
You create an online chat room. You'll work with two XMLHttpRequest objects - one that updates the chat window, an the second that changes the user's color. See the AJAX Chat demo.

Chapter 6: AJAX Suggest and Autocomplete
Just to show Google and Yahoo! that we can do it too, here we teach you create your own Google-suggest like feature, that helps you find PHP functions, and their official documentation. See the AJAX Suggest and Autocomplete demo.

Chapter 7: AJAX Real-Time Charting with SVG
SVG (Scalable Vector Graphics) is a text-based graphics language that can be used to draw shapes and text. (SVG is supported natively by Firefox 1.5, and requires an SVG plugin with other browsers). In this case study you will learn how to implement a realtime charting solution with AJAX and SVG. See the AJAX SVG realtime chart demo. Note that you need to have a web browser that supports SVG. Firefox 1.5 has native support. For Internet Explorer, download the Adobe SVG Viewer.

Chapter 8: AJAX Grid
Data grids are one of the areas where AJAX shows its real strengh. In this case study you'll use XSLT, PHP and MySQL, to build an editable data grid. See the AJAX Grid demo.

Chapter 9: AJAX RSS Reader
RSS aggregator applications are popular these days. Here you learn how to build your own, using once again XSLT to enable flexible output layout. See the RSS Reader demo.

Chapter 10: AJAX Drag and Drop
These days you can choose between so many AJAX frameworks and libraries. This chapter consists of a simple example of using the script.aculo.us JavaScript toolkit.

Appendix A: Configuring Your Working Environment
Includes complete details for installing and configuring your software, to avoid any headaches while going through the case studies. Download Appendix A.

Appendix B: Writing Better Code Using Smarter Tools
If you learn how to use the right tools, you can become very efficient at writing quality code. Here we show you a few of these tools. This Appendix is available as a PDF download only. Download Appendix B.

Appendix C: Advanced XML: XSLT and XPath
Learn about using XSLT and XPath in your AJAX applications. This Appendix is available as a PDF download only. Download Appendix C.

Bonus demo chapter: AJAX Whiteboard
Although it isn't apparent, AJAX can draw as well, and in this case study we'll see how. Our goal here is to build an online whiteboard application, where your visitors can draw and publicly express their artistic skills. Implementing a whiteboard certainly isn't the best real-world scenario for using AJAX, because technologies such as Flash or Java do a much better job at handling complex graphics. However, implementing a whiteboard with AJAX allows us to study some of the more sensitive areas of AJAX development, such as:
  • Drawing graphics using specific algorithms and div elements
  • Efficiently packaging data for client-server communication
  • Synchronizing the same view among many clients
  • Optimizing the database storage and SQL queries for increasing performance
This chapter is available as a PDF download only. Download AJAX Whiteboard Case Study. View the online AJAX Whiteboard demo here, and download its source code here.

Book Translations

If English is not your native language, you may prefer one of the translated versions of the book. (More translations will be announced soon.)

Reviews: AJAX and PHP: Building Responsive Web Applications

Just a test - Okazii Ads