Who This Book Is For

This book is for web developers willing to build better web applications. A basic knowledge of PHP, XML, JavaScript and MySQL, or a strong will to learn-as-you-type, is assumed.

Table of Contents

Chapter 1: AJAX and the Future of Web Applications

Delivering Functionality via the Web

Building Websites Since 1990

Understanding AJAX

Building a Simple Application with AJAX and PHP

Summary

Chapter 2: Client-Side Techniques with Smarter JavaScript

JavaScript and the Document Object Model

JavaScript Events and the DOM

Even More DOM

JavaScript, DOM, and CSS

Using the XMLHttpRequest Object

Working with XML Structures

Summary

Chapter 3: Server-Side Techniqueswith PHP and MySQL

PHP and DOM

Passing Parameters and Handling PHP Errors

Connecting to Remote Servers and JavaScript Security

Using a Proxy Server Script

A Framework for Making Repetitive Asynchronous Requests

Working with MySQL

Wrapping Things Up and Laying Out the Structure

Summary

Chapter 4: AJAX Form Validation

Implementing AJAX Form Validation

Summary

Chapter 5: AJAX Chat

Introducing AJAX Chat

Implementing AJAX Chat

Summary

Chapter 6: AJAX Suggest and Autocomplete

Introducing AJAX Suggest and Autocomplete

Implementing AJAX Suggest and Autocomplete

Summary

Chapter 7: AJAX Real-Time Charting with SVG

Implementing a Real-Time Chart with AJAX and SVG

Summary

Chapter 8: AJAX Grid

Implementing the AJAX Grid Using Client-Side XSLT

Summary

Chapter 9: AJAX RSS Reader

Working with RSS

Implementing the AJAX RSS Reader

Summary

Chapter 10: AJAX Drag and Drop

Using Drag and Drop on the Web

Building the AJAX Drag-and-Drop Sortable List Application

Summary

What You Will Learn

Chapter 1: AJAX and The Future Of Web Applications is an initial incursion into the world of AJAX and the vast possibilities it opens up for web developers and companies, to offer a better experience to their users. In this chapter youâ€™ll also build your first AJAX-enabled web page, which will give you a first look of the component technologies. You can read this chapter in full, for free, here: http://ajaxphp.packtpub.com/1825_01_Final.pdf

Chapter 2: Client-Side Techniques with Smarter JavaScript 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.

Chapter 3: Server-Side Techniques with PHP and MySQL completes the theory foundation by presenting how to create smart servers to interact with your AJAX client. You"ll learn various techniques for implementing common tasks, including handling security and error handling problems.

Chapter 5: AJAX Chat presents a simple online chat that works exclusively using AJAX code, without Java applets, Flash code, or other specialized library, as most chat applications work these days. Chapter 5 has now been updated to cover JSON. You can read the chapter in full, for free, here: www.PacktPub.com/files/Ajax_Chat_and_JSON.pdf [PDF - 1 MB]

Chapter 6: AJAX Suggest and Autocomplete builds a Google-suggest like feature, that helps you find PHP functions, and forward you to the official help page for the chosen function. View AJAX Suggest and Autocomplete demo: http://ajaxphp.packtpub.com/ajax/suggest/

Chapter 7: 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 a SVG plugin with other browsers). In this case study you learn how to implement a realtime charting solution with AJAX and SVG. View SVG Demo here: http://ajaxphp.packtpub.com/ajax/svg_chart/

Chapter 10: AJAX Drag and Drop is a demonstration of using the script.aculo.us framework to build a simple list of elements with drag&drop functionality.

Appendix A: Configuring Your Working Environment teaches you how to install and configure the required software: Apache, PHP, MySQL, phpMyAdmin.

In Detail

Assuming a basic knowledge of PHP, XML, JavaScript and MySQL, this book will help you understand how the heart of AJAX beats and how the constituent technologies work together. After teaching the foundations, the book will walk you through numerous real-world case studies covering tasks youâ€™ll be likely to need for your own applications:

Server-enabled form-validation page

Online chat collaboration tool

Customized type-ahead text entry solution

Real-time charting using SVG

Database-enabled, editable and customizable data grid

RSS aggregator application

A server-managed sortable list with drag&drop support using the script.aculo.us JavaScript toolkit

The appendices guide you through installing your working environment, using powerful tools that enable debugging, improving, and profiling your code, working with XSLT and XPath.

From the Author, Cristian Darie"AJAX and PHP: Building Responsive Web Applications is mainly a book for beginners, but when designing its contents we tried to find the ideal blend of topics that would help both novice and experienced web developers make a big step forward. One customer was very kind to let us know, through a review, that we succeeded:

"The theory behind all the technologies used is very clearly explained, without boring you with details about obvious things. Right from the first chapter you start learning by examples. The examples can be easily adapted to many web projects and they cover stuff that is both useful and fun."

Here are a few examples of such "useful and fun" things that you can find in this book:

details on using proxy scripts to work around the security measures in modern browsers

client-side and server-side code that doesn't break when fed with special characters (such as <, ", etc)

code that works efficiently with Internet Explorer 5, 6 and 7, Firefox, Opera, Safari, and others

a very quick introduction to SVG, the new rebel kid of the web (and of the house)

client-server communication based on message queues that guarantee that your messages aren't lost on the way, and arrive in the intended order at the destination

server-side state management techniques that use query string parameters and database records to keep track of your client's activity

simple yet effective error-handling structures that combine JavaScript code and PHP code to report when something bad happens on the client or on the server

a live errata page that is updated as soon as anyone reports a suggestion or a correction

a friendly AJAX tutorial and many case studies that teach you how to use JavaScript, PHP, MySQL and XML together in order to achieve wonderful results

The book's authors and the publisher are listening to your feedback, and appreciate when you invest some time to let them know what you think. The first result of this collaboration is an updated version of the AJAX Chat case study that uses (and teaches) JSON instead of XML. Find this new chapter in the code download or on my website.

Thanks for reading such a long message. Have fun!" Cristian Darie.

Authors

Bogdan Brinzarea

Bogdan has a strong background in Computer Science holding a Master and Bachelor Degree at the Automatic Control and Computers Faculty of the Politehnica University of Bucharest, Romania and also a

Cristian Darie

Cristian Darie is a software engineer with experience in a wide range of modern technologies, and the author of numerous books, including his popular

Alerts & Offers

Series & Level

We understand your time is important. Uniquely amongst the major publishers, we seek to develop and publish the broadest range of learning and information products on each technology. Every Packt product delivers a specific learning pathway, broadly defined by the Series type. This structured approach enables you to select the pathway which best suits your knowledge level, learning style and task objectives.

Learning

As a new user, these step-by-step tutorial guides will give you all the practical skills necessary to become competent and efficient.

Beginner's Guide

Friendly, informal tutorials that provide a practical introduction using examples, activities, and challenges.

Essentials

Fast paced, concentrated introductions showing the quickest way to put the tool to work in the real world.

Cookbook

A collection of practical self-contained recipes that all users of the technology will find useful for building more powerful and reliable systems.

Blueprints

Guides you through the most common types of project you'll encounter, giving you end-to-end guidance on how to build your specific solution quickly and reliably.

Mastering

Take your skills to the next level with advanced tutorials that will give you confidence to master the tool's most powerful features.

Starting

Accessible to readers adopting the topic, these titles get you into the tool or technology so that you can become an effective user.

Progressing

Building on core skills you already have, these titles share solutions and expertise so you become a highly productive power user.