PHP jQuery Cookbook

jQuery and PHP are the dynamic duo that will allow you to build powerful web applications. This Cookbook is the easy way in with over 60 recipes covering everything from the basics to creating plugins and integrating databases.

PHP jQuery Cookbook

Cookbook
Vijay Joshi

jQuery and PHP are the dynamic duo that will allow you to build powerful web applications. This Cookbook is the easy way in with over 60 recipes covering everything from the basics to creating plugins and integrating databases.
$23.99
$39.99
RRP $23.99
RRP $39.99
eBook
Print + eBook
$12.99 p/month

Want this title & more? Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.
+ Collection
Free Sample

Book Details

ISBN 139781849512749
Paperback332 pages

About This Book

  • Create rich and interactive web applications with PHP and jQuery
  • Debug and execute jQuery code on a live site
  • Design interactive forms and menus
  • Another title in the Packt Cookbook range, which will help you get to grips with PHP as well as jQuery

Who This Book Is For

If you want to use PHP and jQuery together to create web applications this book is for you. It provides a large number of examples in each chapter that will take you from a basic developer to a pro by giving step-by-step instructions for each task in developing web applications using PHP and jQUery. All you need are JavaScript basics and you are on your way to building power web applications, with this book in hand.

Table of Contents

Chapter 1: Handling Events with jQuery
Introduction
Executing functions when page has loaded
Binding and unbinding elements
Adding events to elements that will be created later
Submitting a form with jQuery
Checking for missing images
Creating the select/unselect all checkboxes functionality
Capturing mouse events
Creating keyboard shortcuts
Displaying user selected text
Dragging elements on a page
Chapter 2: Combining PHP and jQuery
Introduction
Fetching data from PHP using jQuery
Creating a query string automatically for all form elements
Detecting an AJAX request in PHP
Sending data to PHP
Aborting AJAX requests
Creating an empty page and loading it in parts
Handling errors in AJAX requests
Preventing browser from caching AJAX requests
Loading JavaScript on demand to reduce page load time
Chapter 3: Working with XML Documents
Introduction
Loading XML from files and strings using SimpleXML
Accessing elements and attributes using SimpleXML
Searching elements using XPath
Reading an XML using DOM extension
Creating an XML using DOM extension
Modifying an XML using DOM extension
Parsing XML with jQuery
Chapter 4: Working with JSON
Introduction
Creating JSON in PHP
Reading JSON in PHP
Catching JSON parsing errors
Accessing data from a JSON in jQuery
Chapter 5: Working with Forms
Introduction
Adding input fields dynamically in a form
Searching for user-inputted string in a page
Checking for empty fields using jQuery
Validating numbers using jQuery
Validating e-mail and website addresses using regular expressions
Displaying errors as user types: Performing live validation
Strengthening validation: validating again in PHP
Creating a voting system
Allowing HTML inside text areas and limiting HTML tags that can be used
Chapter 6: Adding Visual Effects to Forms
Introduction
Creating a Tic-Tac-Toe game with effects
Informing a user while an AJAX request is in progress
Creating expandable and collapsible boxes (accordion)
Fading an element after updating it
Floating box on demand
Updating items in a shopping cart
Chapter 7: Creating Cool Navigation Menus
Introduction
Creating a basic drop-down menu
Creating a menu that changes background on mouse-over
Creating an accordion style menu
Creating a floating menu
Creating an interface for tabbed navigation
Adding more tabs
Creating a wizard using tabs
Chapter 8: Data Binding with PHP and jQuery
Introduction
Fetching data from a database and displaying it in a table format
Collecting data from a form and saving to a database
Filling chained combo boxes that depend upon each other
Checking username availability from database
Paginating data for large record sets
Adding auto-suggest functionality to a textbox
Creating a tag cloud
Chapter 9: Enhancing your Site with PHP and jQuery
Introduction
Sending cross-domain requests using server proxy
Making cross-domain requests with jQuery
Creating an endless scrolling page
Creating a jQuery plugin
Displaying RSS feeds with jQuery and PHP

What You Will Learn

  • Start from the basics and learn pro-level tricks by the end of the book
  • Create interactive and dynamic hierarchical menus
  • Apply eye-catching effects on form elements
  • Integrate a database along with PHP and jQuery
  • Use AJAX to enhance user experience and page interaction
  • Learn how to work with JSON and XML for efficient data exchange
  • Create tools and utilities for your web applications
  • Master form validation on client side as well as server side

In Detail

As web technology evolves, the gap between desktop applications and web applications continues to vanish. And what better way to bridge that gap, for your own website, than using the best two open source technologies in the market: PHP and jQuery. The power-combo of these two is leading the way in revolutionizing the RIA world. Although they are easy to integrate, finding or figuring out how to do what you want to do is rather arduous.

The PHP jQuery Cookbook will be your handy guide with walkthroughs of common integration tasks and problems that will help you master the possibilities available using the PHP and jQuery combo. You will learn quick solutions to necessary tasks to integrate the power of two of the best known and most widely used web technologies of today – PHP on the server side and jQuery on the client side. Glide through the basics and move to advanced topics to create dynamic and interactive web applications with this book in hand.

This book covers a wide array of technical aspects of creating an interactive website. Apart from basics of PHP and jQuery, you will go through advanced topics like creating plugins, validating controls, and useful utilities that you will be able to use as stand-alone tools. AJAX, the key technique of browser-server communication is covered in detail. You will also learn to use JSON, which is becoming preferred as a mode of data interchange over XML, both in web applications and web services.

The book also covers database interaction, which is an important part of any dynamic web application. You will also gain expertise in debugging JavaScript with the help of useful tools that will save you hours of tedious manual debugging.

Most importantly, by using jQuery and PHP together, you will be able to develop applications that are compatible with all major browsers, with no need to write code targeted at specific browsers!

Authors

Table of Contents

Chapter 1: Handling Events with jQuery
Introduction
Executing functions when page has loaded
Binding and unbinding elements
Adding events to elements that will be created later
Submitting a form with jQuery
Checking for missing images
Creating the select/unselect all checkboxes functionality
Capturing mouse events
Creating keyboard shortcuts
Displaying user selected text
Dragging elements on a page
Chapter 2: Combining PHP and jQuery
Introduction
Fetching data from PHP using jQuery
Creating a query string automatically for all form elements
Detecting an AJAX request in PHP
Sending data to PHP
Aborting AJAX requests
Creating an empty page and loading it in parts
Handling errors in AJAX requests
Preventing browser from caching AJAX requests
Loading JavaScript on demand to reduce page load time
Chapter 3: Working with XML Documents
Introduction
Loading XML from files and strings using SimpleXML
Accessing elements and attributes using SimpleXML
Searching elements using XPath
Reading an XML using DOM extension
Creating an XML using DOM extension
Modifying an XML using DOM extension
Parsing XML with jQuery
Chapter 4: Working with JSON
Introduction
Creating JSON in PHP
Reading JSON in PHP
Catching JSON parsing errors
Accessing data from a JSON in jQuery
Chapter 5: Working with Forms
Introduction
Adding input fields dynamically in a form
Searching for user-inputted string in a page
Checking for empty fields using jQuery
Validating numbers using jQuery
Validating e-mail and website addresses using regular expressions
Displaying errors as user types: Performing live validation
Strengthening validation: validating again in PHP
Creating a voting system
Allowing HTML inside text areas and limiting HTML tags that can be used
Chapter 6: Adding Visual Effects to Forms
Introduction
Creating a Tic-Tac-Toe game with effects
Informing a user while an AJAX request is in progress
Creating expandable and collapsible boxes (accordion)
Fading an element after updating it
Floating box on demand
Updating items in a shopping cart
Chapter 7: Creating Cool Navigation Menus
Introduction
Creating a basic drop-down menu
Creating a menu that changes background on mouse-over
Creating an accordion style menu
Creating a floating menu
Creating an interface for tabbed navigation
Adding more tabs
Creating a wizard using tabs
Chapter 8: Data Binding with PHP and jQuery
Introduction
Fetching data from a database and displaying it in a table format
Collecting data from a form and saving to a database
Filling chained combo boxes that depend upon each other
Checking username availability from database
Paginating data for large record sets
Adding auto-suggest functionality to a textbox
Creating a tag cloud
Chapter 9: Enhancing your Site with PHP and jQuery
Introduction
Sending cross-domain requests using server proxy
Making cross-domain requests with jQuery
Creating an endless scrolling page
Creating a jQuery plugin
Displaying RSS feeds with jQuery and PHP

Book Details

ISBN 139781849512749
Paperback332 pages
Read More