PacktLib: PHP jQuery Cookbook

PHP jQuery Cookbook

Credits

About the Author

About the Reviewers

www.PacktPub.com

Preface

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

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

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

Working with JSON

Introduction

Creating JSON in PHP

Reading JSON in PHP

Catching JSON parsing errors

Accessing data from a JSON in jQuery

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

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

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

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

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

Firebug

Firebug

Firebug

Firebug

Firebug

Index