You are previewing AJAX and PHP.
O'Reilly logo

Book Description

Build user friendly Web 2.0 Applications with JavaScript and PHP

  • The ultimate AJAX tutorial for building modern Web 2.0 Applications

  • Create faster, lighter, better web applications by using the AJAX technologies to their full potential

  • Leverage the power of PHP and MySQL to create powerful back-end functionality and make it work in harmony with a responsive AJAX clientWrite better JavaScript code to enable powerful web features

  • Understand the complete client-server mechanism by following complete, step-by-step case studies

In Detail

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.

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.

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.

Table of Contents

  1. AJAX and PHP
    1. AJAX and PHP
    2. Credits
    3. About the Authors
    4. About the Reviewer
    5. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Errata
        2. Piracy
        3. Questions
    6. 1. The World of AJAX and PHP
      1. The big picture
        1. AJAX and Web 2.0
      2. Building websites since 1990
        1. HTTP and HTML
        2. PHP and other server-side technologies
        3. JavaScript and other client-side technologies
        4. What's missing?
      3. The world of AJAX
        1. What is AJAX made of?
        2. Uses and misuses of AJAX
        3. Resources and tools
      4. Setting up your environment
      5. Building a simple application with AJAX and PHP
            1. Time for action—— Quickstart AJAX
              1. What just happened?
      6. Summary
    7. 2. JavaScript and the AJAX Client
      1. JavaScript and the Document Object Model
            1. Time for action— playing with JavaScript and the DOM
              1. What just happened?
      2. JavaScript events and the DOM
            1. Time for action— using JavaScript events and the DOM
              1. What just happened?
      3. Even more DOM
            1. Time for action—even more DOM
              1. What just happened?
      4. JavaScript, DOM, and CSS
            1. Time for action— working with CSS and JavaScript
              1. What just happened?
      5. Using the XMLHttpRequest object
        1. Creating the XMLHttpRequest object
          1. JavaScript exception handling
          2. Creating better objects for Internet Explorer 6
        2. Initiating server requests using XMLHttpRequest
        3. Handling server response
            1. Time for action— making asynchronous calls with XMLHttpRequest
              1. What just happened?
      6. Working with XML structures
            1. Time for action— making asynchronous calls with XMLHttpRequest and XML
              1. What just happened?
        1. Handling more errors and throwing exceptions
        2. Creating XML structures
      7. Summary
    8. 3. Object Oriented JavaScript
      1. Why is OOP in JavaScript important?
      2. Object-oriented programming concepts
        1. Encapsulation
        2. Inheritance
        3. Polymorphism
      3. Object-oriented programming with JavaScript
        1. JavaScript objects are dictionaries
        2. JavaScript functions
          1. JavaScript functions are first-class objects
          2. Inner functions
          3. Closures
        3. JavaScript classes
          1. Constructors
          2. Class diagrams
          3. Referencing external functions
          4. Prototype objects
          5. Instance methods and properties
          6. Static methods and properties
          7. Private members
        4. The JavaScript execution context
          1. var x, this.x, and x
          2. Using the right context
      4. JavaScript OOP in practice: Introducing JSON
          1. JSON concepts
          2. A simple JSON example
            1. Time for action— using JSON
      5. Summary
    9. 4. Using PHP and MySQL on the Server
      1. PHP, DOM, and XML
            1. Time for action— server-side AJAX with PHP and XML
              1. What just happened?
      2. PHP and JSON
            1. Time for action— server-side AJAX with PHP and JSON
              1. What just happened?
      3. Passing parameters and handling PHP errors
            1. Time for action— passing PHP parameters and error handling
              1. What just happened?
                1. divide.php
                2. error_handler.php
                3. handleServerResponse()
      4. Working with MySQL
        1. Creating database tables
        2. Manipulating data
        3. Connecting to your database and executing queries
            1. Time for action— working with PHP and MySQL
              1. What just happened?
      5. Summary
    10. 5. AJAX Form Validation
      1. Implementing AJAX form validation
      2. XMLHttpRequest, version 2
            1. Time for action— the XmlHttp object
              1. What just happened?
      3. AJAX form validation
            1. Time for action—— AJAX form validation
              1. What just happened?
      4. Summary
    11. 6. Debugging and Profiling AJAX Applications
      1. Debugging and profiling with Internet Explorer
        1. Enabling debugging in Internet Explorer 6 and 7
        2. Debugging in Internet Explorer 8
        3. Other Internet Explorer debugging tools
      2. Debugging and profiling with Firefox
        1. Firebug
        2. Venkman JavaScript debugger
        3. Web Developer
      3. Summary
    12. 7. Advanced Patterns and Techniques
      1. Predictive fetching pattern
      2. Progress indicator pattern
      3. Unobtrusive JavaScript
      4. Progressive enhancement and graceful degradation
      5. Asynchronous file upload with AJAX
        1. HTTP and how file upload works
        2. Iframe for asynchronous file upload with AJAX
            1. Time for action—asynchronous file upload with AJAX
              1. What just happened?
      6. Cross-domain calls
        1. Cross-domain calls using a server proxy
        2. Cross-domain calls using Flash
        3. Cross-domain calls using iframes
        4. Cross-domain calls using JSONP
      7. Cross-site request forgery
        1. JSON hijacking
        2. Mitigations of CSRF
      8. Cross-site scripting
        1. Exploits
          1. Non-persistent XSS
          2. Persistent XSS
        2. Mitigations of XSS
          1. Input validation
          2. Escaping
            1. Cookies security
        3. Summary
    13. 8. AJAX Chat with jQuery
      1. Chatting using AJAX
      2. jQuery
        1. Before we get started
        2. The first steps
          1. jQuery DOM Selectors
          2. jQuery wrapper object
        3. Method chaining
        4. Event handling
        5. A simple example
        6. Basic concepts
      3. AJAX chat
        1. The chat application
            1. Time for action— implementing AJAX chat with JSON
              1. What just happened?
              2. How does the color picker work?
      4. Summary
    14. 9. AJAX Grid
      1. Implementing the AJAX data grid
        1. Code overview
          1. The database
          2. Styles and colors
          3. The server side
          4. Creating the grid, step by step
      2. Summary
    15. A. Preparing Your Working Environment
      1. Installing XAMPP
        1. Installing XAMPP on Windows
          1. Installing XAMPP on Linux
        2. Preparing the AJAX database