You are previewing PHP Ajax Cookbook.
O'Reilly logo
PHP Ajax Cookbook

Book Description

Over 60 simple but incredibly effective recipes to Ajaxify PHP websites.

  • Learn how to develop and deploy iPhone web and native apps.

  • Optimize the performance of Ajax applications.

  • Build dynamic websites with faster response from the server using the asynchronous call feature of PHP Ajax.

  • Using Ajax allows quick and efficient access of data from the server, thus precluding a total web page refresh.

  • Leverage the power of PHP Ajax using practical recipes with example codes.

  • In Detail

    Ajax is the necessary paradigm in Web 2.0 sites. Most of the Web 2.0 sites are built with PHP and Ajax. Extending AJAX is about delivering front-end service for accessing back-end services in PHP in a quick and easy manner. With this book in hand, you will learn how to use the necessary tools for Ajaxification of websites and iPhones.

    PHP AJAX cookbook will teach you how to use the combination of PHP AJAX as a powerful platform for websites or web applications. Using AJAX for Communication with Server leads to faster response with PHP at the back-end services. The combination of AJAX PHP has many features such as speeding up the user experience, giving your web client much quicker response time and letting the client browser retrieve data from the server without having to refresh the whole page. You will learn the nuances of optimization and debugging Ajax applications. Further, you will learn how to program Ajax on iPhone devices.

    This book will teach you popular selector-based JavaScript followed by important concepts on debugging, optimization and best practices. There is a collection of recipes focused on creating basic utilities such as validating form using Ajax and creating a five star rating system. As jQuery is quite popular, useful tools and jQuery plugins like Ajax tooltips, tab navigation, autocomplete, shopping cart, and Ajax chat are covered subsequently. By the end of chapter 7 you will learn to visually speed up website responsiveness to building SEO-friendly Ajax websites. Also get to know about all popular Ajax webservices and APIs like Twitter, Facebook and Google Maps which are covered in Ajax Mashups. Finally, step-by-step recipes are presented to build iPhone apps using basic libraries and everyday useful Ajax tools.

    Build rich interactive web 2.0 sites with rich standards and Mashups around PHP Ajax.

    Table of Contents

    1. PHP Ajax Cookbook
      1. PHP Ajax Cookbook
      2. Credits
      3. About the Authors
      4. About the Reviewers
      5. www.PacktPub.com
            1. Support files, eBooks, discount offers, and more
              1. Why Subscribe?
              2. Free Access for Packt account holders
      6. 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. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      7. 1. Ajax Libraries
        1. Designing simple navigation using jQuery
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        2. Creating tab navigation
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Designing components using Ext JS
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        4. Event handling in MochiKit
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        5. Building a tab navigation using Dojo
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Building a chart application using YUI library
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        7. Loading dynamic content using jQuery slider
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        8. Creating an Ajax shopping cart using MooTools
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        9. Building an Ajax login form using prototype.js
          1. Getting ready
          2. How to do it...
            1. How it works...
            2. There's more...
      8. 2. Basic Utilities
        1. Validating a form using Ajax
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        2. Creating an autosuggest control
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        3. Making Form Wizards
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        4. Uploading a file using Ajax
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        5. Uploading multiple files using Ajax
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        6. Creating a five-star rating system
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        7. Building a PHP Ajax contact form with validation
          1. How to do it...
          2. How it works...
          3. There's more...
        8. Displaying a table in Ajax
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        9. Building Pagination using PHP and Ajax
          1. How to do it...
          2. How it works...
          3. There's more...
      9. 3. Useful Tools Using jQuery
        1. Making tool tips using Ajax
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        2. Creating Autocomplete from a database
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        3. Building a tab navigation using jQuery
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Rotating content
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        5. Creating an image slider
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        6. Creating pageless pagination
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        7. Loading images using Lightbox
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        8. Growing textarea using the jGrow plugin
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        9. HTML replacement of the select dropdown
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        10. Improving date selection with Datepicker
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        11. Drag-and-drop functionality
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        12. Ajax shopping cart
          1. Getting ready
          2. How to do it...
            1. How it works...
            2. There's more...
        13. Sorting and filtering data
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        14. Adding visual effects and animations
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
      10. 4. Advanced Utilities
        1. Building an Ajax chat system using the Comet technique
          1. Getting ready
          2. How to do it...
            1. How it works...
        2. Charting with JavaScript
          1. Getting ready
          2. How it works...
            1. Drawing a line chart
            2. Drawing a bar chart
            3. Drawing a 3D pie chart
        3. Decoding CAPTCHA through canvas
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        4. Displaying data in a grid
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Other data grid plugins
            2. Displaying millions of data items
      11. 5. Debugging and Troubleshooting
        1. Debugging with Firebug and FirePHP
          1. Debugging with Firebug
          2. How to do it...
          3. How it works...
          4. There's more...
          5. Debugging with FirePHP
          6. Getting ready
          7. How it works...
          8. There's more...
        2. Debugging with the IE developer toolbar
          1. Getting ready
          2. How to do it...
        3. Avoiding the framework $ conflict
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Using the anonymous function of JavaScript
          1. How to do it...
          2. How it works...
          3. There's more...
        5. Fixing memory leaks in JavaScript
          1. What is a memory leak?
          2. What might cause a memory leak?
        6. Fixing memory leaks
          1. How to do it...
          2. How it works...
          3. There's more...
        7. Sequencing Ajax Requests
          1. How to do it ...
          2. How it works...
        8. Cross Browser and Ajax
        9. Beautifying JavaScript
      12. 6. Optimization
        1. Caching of objects
          1. Getting ready
          2. How to do it...
          3. How it works...
        2. Getting optimization tips with YSlow
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        3. Speeding up JavaScript delivery through automatic compression and browser caching
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Comparing JavaScript minification tools
            2. Automatic speed up tools
        4. Triggering JavaScript early/on DOM load
          1. Getting ready
          2. How to do it...
          3. How it works...
            1. DOMContentLoaded and workarounds
          4. There's more...
        5. Lazy-loading of images
          1. Getting ready
          2. How to do it...
            1. Pure JavaScript approach
            2. Mangled HTML markup
          3. How it works...
          4. There's more...
            1. Lazy-loading plugins
            2. Lazy/deferred script loading
        6. Optimizing Ajax applications automagically through Apache modules/Google mod_pagespeed
          1. Getting ready
          2. How to do it...
            1. How it works...
            2. There's more...
              1. Testing HTTP headers
              2. Testing mod_pagespeed without installing
              3. Page Speed Service
      13. 7. Implementing Best Practices to Build Ajax Websites
        1. Avoiding HTML markup-specific coding
          1. Getting ready
          2. How to do it...
          3. How it works...
            1. Introducing protocols through naming conventions:
            2. Approaching the problem statement:
          4. There's more...
            1. console.warn()
        2. Building secure Ajax websites
          1. Getting ready
          2. How to do it...
            1. Common mistakes on Ajax applications
          3. How it works...
          4. There's more...
            1. Exploit-Me
            2. WebInspect
            3. Resources
        3. Building SEO-friendly Ajax websites
          1. Getting ready
          2. How to do it...
          3. How it works...
            1. Google's proposal
        4. Preserving browser history or un-breaking the browser's back button
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Implementing comet PHP and Ajax
          1. Getting ready
          2. How to do it...
          3. How it works...
      14. 8. Ajax Mashups
        1. Web services
          1. SOAP
          2. REST
        2. XML-RPC
        3. Creating and consuming web services using PHP
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Using Flickr API with Ajax
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        5. Using Twitter API with Ajax
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Translating text using Google Ajax API
          1. Getting ready
          2. How to do it...
          3. How it works...
        7. Using Google Maps
          1. Getting ready
          2. How to do it...
          3. How it works...
        8. Searching a location within a Google Map
          1. Getting ready
          2. How to do it...
          3. How it works...
        9. Searching within XX km. radius of Google Maps with markers and Info window
          1. Getting ready
            1. Haversine formula for calculating circular distance
            2. Creating the table
          2. How to do it...
          3. How it works...
        10. Finding a city/country using IP address
          1. Getting ready
          2. How to do it...
          3. How it works...
        11. Converting currencies using Ajax and PHP
          1. Getting started
          2. How to do it...
          3. How it works...
      15. 09. iPhone and Ajax
        1. Building a touch version of a website (with jQTouch)
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Online iPhone icon generator
        2. Leveraging HTML5 features in iPhone Ajax
          1. Getting ready
          2. How to do it...
            1. How it works...
            2. There's more...
              1. HTML5 demos
              2. Persist JS
        3. Building native apps with PhoneGap
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Getting Started Guide/Help Wizard
        4. Speeding up a PhoneGap project
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        5. Building a currency conversion hybrid app
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Mustache
            2. drink, jQuery micro template