Book Image

AJAX and PHP: Building Modern Web Applications 2nd Edition

By : Audra Hendrix, Bogdan Brinzarea, Cristian Darie
Book Image

AJAX and PHP: Building Modern Web Applications 2nd Edition

By: Audra Hendrix, Bogdan Brinzarea, Cristian Darie

Overview of this book

<p>AJAX enables interactive interfaces that can replace traditional user interfaces. 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.<br /><br />Detailed description<br />The best AJAX tutorial for PHP developers has been completely rewritten to be your friendly guide to modern Web 2.0 development techniques! AJAX and PHP: Building Modern Web Applications, 2nd Edition covers every significant aspect of creating and maintaining AJAX and PHP applications.<br /><br />This book will teach you how to use PHP, JavaScript, MySQL and jQuery to build modern, responsive web applications. After building a strong foundation, the book will walk you through numerous real-world case studies covering techniques you’ll be likely to need for your own applications:</p> <ul> <li>Learn how to write unobtrusive, degradable, portable, SEO-friendly AJAX code</li> <li>Understand the object-oriented model of JavaScript and JSON</li> <li>Learn how to use the jQuery JavaScript library by going through two complete case studies</li> <li>Debug your AJAX and PHP code using modern tools</li> <li>Assess the security implications of writing AJAX code and avoid security risks such as cross-site scripting</li> <li>Learn advanced AJAX and PHP patterns and techniques such as predictive fetching, progress indicator, graceful degradation, cross-domain calls, and more</li> <li>Understand the complete client-server mechanism by going through complete, step-by-step case studies, including AJAX Form Validation, and AJAX Online Chat and AJAX Editable DataGrid with jQuery</li> </ul>
Table of Contents (16 chapters)
AJAX and PHP
Credits
About the Authors
About the Reviewer
Preface
Index

PHP, DOM, and XML


To begin understanding the server-side techniques and principles used in AJAX, in the first exercise of this chapter, you'll create a PHP script that uses PHP's DOM functions to dynamically create XML output, which is then read by the client.

Remember that we assume you have basic knowledge of PHP. If you need additional assistance with the PHP code, we recommend you google "php tutorial", which will lead you to lots of interesting resources, including the official PHP tutorial at http://php.net/tut.php. If you enjoy learning by practice, check out Cristian Darie's PHP e-commerce books, such as Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition.

In the previous chapters, you learned how to use DOM and Javascript on the client side to:

  • Manipulate the HTML page while you are working on it

  • Read and parse XML and JSON documents received from the server

  • Create new XML and JSON documents

On the server side, you can use the DOM and PHP in order to:

  • Compose...