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

Unobtrusive JavaScript


Unobtrusive JavaScript represents a technique that separates the JavaScript behavioral code from the page's content and presentation. This greatly eases maintainability, but several factors need to be carefully considered and addressed when using this technique:

  1. JavaScript inline <script> elements are not used; only <script> elements with src attributes are used:

    <script type="text/javascript" src="path/filename.js"></script>.
  2. All the JavaScript code resides in separate JavaScript files.

  3. No use of inline event attributes on HTML elements.

  4. Don't depend on JavaScript; the site must remain usable without JavaScript; don't assume it will be available on every browser, every time.

  5. Test objects before using them. Test objects before using them. Oh, and test objects before using them.

  6. Avoid any cross-browser problems by choosing solid, proven frameworks for DOM manipulation, event handling, animations, and AJAX.

  7. Separate the behavioral layer from the content...