close

Head First Ajax

Head First Ajax

Head First Ajax is a complete learning experience for dynamic, interactive web application programming. Built for your brain, this book covers JavaScript, XHTML, asynchronous and synchronous requests, the DOM, and everything else you'll need to expand and revolutionize the abilities of your web apps. You'll do more than just memorize methods from a framework someone else wrote, or drag-and-drop widgets from a toolkit. By the time you're through, you'll be building apps that talk to the server without page reloads, move items around on the screen in response to users' actions, and even anticipate your users' mistakes… before they're made.

Table of Contents

1. Using Ajax: Web Apps for a New Generation
2. Designing Ajax Applications: Thinking Ajaxian
3. JavaScript Events: Reacting to Your Users
4. Multiple Event Handlers: Two's Company
5. Asynchronous Applications: It's like Renewing Your Driver's License
6. The Document Object Model: Web Page Forestry
7. Manipulating the DOM: Your Wish is My Command
8. Frameworks and Toolkits: Trust No One
9. XML Requests and Responses: More Than Words Can Say
10. JSON: SON of JavaScript
11. Forms and Validation: Say What You Meant to Say
12. Post Requests: Paranoia: It's Your Friend
i. Leftovers: The top 10 things we didn't cover
ii. Utility Functions: Just gimme the code

A collection of images from inside the book.

Code Downloads and Example Web Sites

Check out these pages for downloadable packages of the final versions of the sites in the book, as well as links to view them in your browser.

1. Using Ajax: Web Apps for a New Generation
2. Designing Ajax Applications: Thinking Ajaxian
3. JavaScript Events: Reacting to Your Users
4. Multiple Event Handlers: Two's Company
5. Asynchronous Applications: It's like Renewing Your Driver's License
6. The Document Object Model: Web Page Forestry
7. Manipulating the DOM: Your Wish is My Command
8. Frameworks and Toolkits: Trust No One
9. XML Requests and Responses: More Than Words Can Say
10. JSON: SON of JavaScript
11. Forms and Validation: Say What You Meant to Say
12. Post Requests: Paranoia: It's Your Friend

Read Me:
What you should know before reading this book

This is a learning experience, not a reference book. We deliberately stripped out everything that might get in the way of learning whatever it is we're working on at that point in the book. And the first time through, you need to begin at the beginning, because the book makes assumptions about what you've already seen and learned.

We assume you are familiar with HTML and CSS.

It would take an entire book to teach you HTML and CSS (in fact, that's exactly what it took: Head First HTML with CSS & XHTML). We chose to focus this book on Ajax programming, rather than rehash lots of markup and style that you could learn about in other places.

We assume you've at least seen JavaScript code before.

It would take an entire book to teach you... oh, wait, we've already said that. Seriously, JavaScript is a lot more than a simple scripting language, and we aren't going to cover all the ways you can use JavaScript in this book. You'll learn about all the ways that JavaScript is related to Ajax programming, and learn how to use JavaScript extensively to add interaction to your web pages and make requests to a server.

However, if you've never written a line of JavaScript, aren't at all familiar with functions or curly braces, or have never programmed in any language before, you might want to pick up a good JavaScript book and browse through it. If you want to plow into this book, feel free—but we will be moving fairly quickly over the basics.

We don't cover server-side programming in this book.

It's now common to find server-side programs written in Java, PHP, Ruby, Python, Perl, Ruby on Rails, C#, and a whole lot more. Ajax programming works with all of these languages, and we have tried to represent several of them in this book's examples.

To keep you focused on learning Ajax, though, we do not spend much time explaining the server-side programs used; we'll show you the basic inputs and outputs to the server, but that's as far as we go. We believe that your Ajax applications can be written to work with any kind of server-side program; we also believe that you're smart enough to apply the lessons learned from an example that uses PHP to one that uses Ruby on Rails or a Java servlet.

We encourage you to use more than one browser with this book.

As much as it sucks, different web browsers handle your HTML, your CSS, and your JavaScript in completely different ways. If you want to be a complete Ajax programmer, you should always test your asynchronous applications on lots of modern browsers. All the examples in this book were tested on recent versions of Firefox, Opera, Safari, Internet Explorer, and Mozilla. If you find problems, though, let us know... we promise it's an accident.

We often use tag names for element names.

Rather than saying "the a element", or "the 'a' element", we use a tag name, like "the <a> element". While this may not be technically correct (because <a> is an opening tag, not a full blown element), it does make the text more readable, and we always follow the name with the word "element" to avoid confusion.

Advance Praise

"The author does an excellent job teaching the various aspects of Ajax, bringing back previous lessons without being repetitive and introducing common problems in a way that helps readers discover the problems themselves. In areas where there still isn't a definitive best practice, the reader is exposed to all the options and encouraged to make up his or her own mind."
— Elaine Nelson, http://elainenelson.org/

"Ajax is more than just revisiting existing technologies, making some small changes to your web application and then declaring it Ajax-enabled. Rebecca M. Riordan walks you through all of the steps of building an Ajax application in Head First Ajax, and shows you that Ajax is more than 'that little asynchronous part', but a better approach to web design all together."
— Anthony T. Holdener III

"You don't just read Head First books, you do Head First books. And it makes all the difference."
— Pauline McNamara

"Behind the Ajax eight ball? Get out of the shadows with this book. You'll wrap your mind around the core concepts, and have some fun in the process."
— Bear Bibeault, Web Applications Architect
Order
(opens a new window)

Buy 2 books, get 1 free!

Buy 2 books and get the third free! Use the coupon code OPC10 when you check out.

Who is this book for?

If you can answer "yes" to all of these:

  • Do you know HTML, some CSS, and some JavaScript? (You don't need to be a guru or anything.)

  • Do you want to learn, understand, and remember Ajax, with a goal of developing responsive and usable web applications
  • Do you prefer stimulating dinner party conversation to dry, dull, academic lectures?

You should probably back away from this book if you can answer "yes" to any of these:

  • Are you completey new to HTML or CSS or JavaScript? (You don't need to be advanced, but you should definitely have some experience. If not, go get a copy of Head First HTML and CSS, today, and then come back and get this book.)
  • Are you a kick-butt Ajax or web developer looking for a reference book?
  • Are you afraid to try something different? Would you rather have a root canal than mix stripes with plaid? Do you believe that a technical book can't be serious if servers and web browsers are anthropomorphized?

Forum

Ask the authors questions and chat with fellow readers in the Head First Ajax Forum.