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 specifc 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 fles 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 felds,
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 fy.
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.
pages. You will learn how to edit HTML and change the appearance of pages on the browser
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 profciency, 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.Preface
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.
In this book, you will fnd 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:
$(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".
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 firstname.lastname@example.org, 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 email@example.com.
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.
Downloading the example code for this book
You can download the example code fles 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 fles e-mailed directly to you.Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen.
If you fnd 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 fnd 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 verifed, 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 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 firstname.lastname@example.org with a link to the suspected
We appreciate your help in protecting our authors, and our ability to bring you
You can contact us at email@example.com if you are having a problem with any
aspect of the book, and we will do our best to address it.