Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
PHP jQuery Cookbook

You're reading from   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.

Arrow left icon
Product type Paperback
Published in Dec 2010
Publisher Packt
ISBN-13 9781849512749
Length 332 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Vijay Joshi Vijay Joshi
Author Profile Icon Vijay Joshi
Vijay Joshi
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

PHP jQuery Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Handling Events with jQuery FREE CHAPTER 2. Combining PHP and jQuery 3. Working with XML Documents 4. Working with JSON 5. Working with Forms 6. Adding Visual Effects to Forms 7. Creating Cool Navigation Menus 8. Data Binding with PHP and jQuery 9. Enhancing your Site with PHP and jQuery Firebug Index

Preface

Nowadays, web applications are behaving more and more like desktop applications with lesser page loads and more user interaction and effects. The Web has become faster and applications such as Gmail and Facebook have given a new meaning to web applications.

PHP on the server side and jQuery on the client side (browser) are a killer combination for developing interactive web applications. PHP is the leading language of choice among web developers and jQuery is now used on more than one-third of the top 1000 sites on the internet and is the most widely-used library.

One thing that PHP and jQuery have in common is that they are easy to learn. Once you know the basics, you can promote yourself to the next level easily.

And this is what the book will do for you. It is like a toolbox having a myriad of tools inside. It will allow you to write faster web applications, which feel like desktop applications, with the help of PHP and jQuery. Whether you want to learn live validations, create plugins, drag elements, create a menu, watch videos using YouTube API, or interact with the database, just jump to the respective recipe for the solution. AJAX, a key feature of rich internet applications, is also covered in detail.

You are not required to read this book from the beginning to the end. Each recipe is independent and is like a "how to" or a mini application in itself. You can directly look for a solution to a specific problem.

I hope you will find this book useful and that it will help you to take your skills to a higher level.

What this book covers

Chapter 1, Handling Events with jQuery, helps you understand jQuery's cross-browser event handling methods. You will learn to work with keyboard and mouse events. Advance event handling topics, such as dragging and keyboard shortcuts are also discussed.

Chapter 2, Combining PHP and jQuery, lists several ways of sending AJAX requests using jQuery and also describes how PHP responds to such requests. This chapter also contains recipes that deal with caching of AJAX requests and error handling during AJAX requests.

Chapter 3, Working with XML Documents, explains working with XML files in PHP as well as jQuery. Recipes will describe how to read, write, and modify XMLs using DOM and SimpleXML extensions of PHP. Parsing XML with jQuery is also discussed.

Chapter 4, Working with JSON, discusses JSON in detail. You will be shown how to read and write JSON data in PHP, and also explore jQuery's inbuilt capabilities of parsing JSON.

Chapter 5, Working with Forms, deals with forms and form validations. You will learn how to validate forms for different types of data with jQuery. This will cover validating empty fields, numbers, e-mail addresses, web addresses, and much more. Server-side validation methods will also be discussed to make validations more powerful.

Chapter 6, Adding Visual Effects to Forms, extends the previous chapter and provides recipes for adding visual effects to forms. Recipes in this chapter allow you to create user-friendly forms by adding effects, such as highlighting, fading, expandable boxes, and various others.

Chapter 7, Creating Cool Navigation Menus, describes the creation of different types of menus, such as animated menus, accordions, and tabbed menus. Advanced techniques for creating tabs are also covered that will guide you in adding and removing tabs on the fly.

Chapter 8, Data Binding with PHP and jQuery, explains, in detail, how a database can be used along with PHP and jQuery. Examples included in this chapter will explain how to fetch data from the database and use it in web forms.

Chapter 9, Enhancing your Site with PHP and jQuery, teaches you some advanced techniques of PHP and jQuery. It will show how to overcome browser restrictions like cross-domain requests. You will learn to create a jQuery plugin for custom use and an endless scrolling page among other things.

Appendix, Firebug, explains the use of Firebug for debugging HTML and JavaScript in web pages. You will learn how to edit HTML and change the appearance of pages on the browser itself without switching to actual code files. You will be able to execute JavaScript directly from Firebug and further understand debugging JavaScript using this add-on.

What you need for this book

You should have Apache (or another web server), PHP (version 5.0 or above), and MySQL installed on your system to be able to run the examples in this book. You can install them all at once using software such as WampServer or you can install them separately. jQuery (version 1.3.2 or higher) will also be required.

In terms of technical proficiency, this book assumes that you have working knowledge of PHP, jQuery, HTML, and CSS. You need to know only the basics of these, leave the rest to this book.

Who this book is for

This book is for PHP and jQuery developers who just know the basics of these two and want to use PHP and jQuery together to create rich internet applications. It provides a large number of examples in each chapter that will take you from being a basic developer to a pro by giving step-by-step instructions for each task in developing web applications using PHP and jQuery.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "The input button has also been attached to a click event."

A block of code is set as follows:

$('input:text').bind(
{
  focus: function()
  {
   $(this).val('');
  },
  blur: function()
  {
    $(this).val('Enter some text');
  }
});

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Now click on the Create New Element button a few times to create some DIV elements".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail .

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Tip

Downloading the example code for this book

You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime