Book Image

jQuery 2.0 Development Cookbook

By : Leon Revill
Book Image

jQuery 2.0 Development Cookbook

By: Leon Revill

Overview of this book

Table of Contents (17 chapters)
jQuery 2.0 Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a search feature


Allowing your users to search through data within your web application is a basic principle. This recipe will show you how to create a fast and efficient search feature that uses jQuery and AJAX with a PHP and MySQL backend.

Getting ready

This recipe not only requires that you have a running web server that has PHP5, but you will also need a MySQL server that is ready to accept connections from PHP scripts.

How to do it…

Learn how to create a search feature from scratch, which will show you valuable jQuery principles in action, by performing the following steps:

  1. We need to create a database and a table to store the data that the users will be able to search. Create a database named jquerycookbook on your database server, and use the following SQL code to create and populate a table with some data:

    USE `jquerycookbook`;
    
    CREATE TABLE IF NOT EXISTS `stationary` (
      `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
      `title` varchar(128) NOT NULL,
      PRIMARY KEY (`id`)
    )...