This book does not require you to start from the beginning and read it all the way to the end. I've tried to make each chapter as standalone as possible. Having said that, there is some small degree of building on a previous chapter's work, primarily in the use of an Adding Ajax library that is created as the book proceeds. However, all of the material is included in the downloadable examples. I would, however, recommend that you read Chapter 1 and Chapter 2 before you read any other chapters.
The following is a brief synopsis of each chapter:
- Chapter 1
Provides an overview of the Ajax technologies, but also covers the importance of developing a strategy for change to your site before sitting down to code. It covers the importance of discovering your audience and provides tips on how you can accomplish this task. It also covers the importance of standards and making sure you have a good, solid web page before you begin to add any Ajax effects. Once you've read this chapter, you're ready to add any of the Ajax effects covered in the later chapters.
- Chapter 2
Provides a nuts-and-bolts coverage of the heart and soul of Ajax: how to work with the
XMLHttpRequest
object. In this chapter, I cover how to request a web service using both a GET and a POST request, as well as how to use dynamic scripting for cross-domain data requests. As for types of data, I cover HTML, XML, as well as the newer JavaScript Object Notation (JSON). I also discuss the asynchronous nature of Ajax requests and cover some of the potential gotchas and performance issues.- Chapter 3
Introduces and demonstrates several of the more important Ajax libraries, including Prototype, script.aculo.us, Rico, MochiKit, and so on. Though most of the examples don't use an external library, each chapter does have a sprinkling of examples using some of the libraries so that you can become familiar with the effect, learn how to extend libraries, package your own libraries, and discover some of interesting challenges associated with multilibrary Ajax development.
- Chapter 4
Gets into the interactive element that is Ajax, including how to work with events and event handlers that works across browsers, and what works if more than one library is used. In addition, we'll look at building tool tips, pulling in help data from external sources, creating an Ajax "fade" to signal changes, live previews, and merging live previews with live updates.
- Chapter 5
Explores the concept of web page as space, and covers three popular approaches to managing web space. These include the accordion, where space is collapsed vertically; the tabbed page, where pages are served when tabs are clicked; and the overlay, where the page is overlayed with a message, photo, or other material. This chapter also explores how to package complete "effects" so that one library can provide effects for any number of applications and pages. This chapter also looks at how these effects can be integrated with web service requests.
- Chapter 6
This is a real nuts-and-bolts chapter. It gets into how to make data updates, including adding new data, deleting, and making updates, all from within a single page. It focuses on extending existing web applications so that form updates and Ajax updates coexist harmoniously. It also incorporates the use of "fades" to add polish and feedback to your application users. Some of the performance and security issues associated with database access through Ajax are also covered, as is the use of "live" updates and effects like drag-and-drop sorting.
- Chapter 7
This is where we explore the Ajax effects on the Web, including breaking the Back button, losing the browser history, dynamic effects that disappear when the page is refreshed, and being able to link or bookmark an Ajax "page." In this chapter, we explore the approaches that can be taken to restore much of the lost web effects, and we will develop a better sense of how far we can take Ajax and still keep the best part of the Web.
- Chapter 8
This chapter is pure fun. We've worked hard and now we can take out the paintbrush and fingerpaint set and go wild. This chapter covers some advanced CSS effects, including drag-and-drop "scrollbars," pagination, and the use of SVG, and the
Canvas
object. Though the support for the latter two items is not universal, support is growing and if used to supplement data presented in more traditional ways, can be both fun and effective.- Chapter 9
Explores mashups. One of the most powerful aspects of Ajax is the ability to bring in web services, our own and others, and combine the data in any number of ways directly in our web pages. This chapter takes maps from Google, photo information from Flickr, and weblog information from Technorati, mashes it all up in a nice tabbed page interface, and then shows how all of that can be implemented in such a way that it works whether scripting is enabled or not.
- Chapter 10
This chapter is both the long breath after the many code examples and a second look at issues of performance, architecture, and security. Privacy of web services is touched on, as well as distributing resource needs and how tightly coupled you want your server and client components to be. The chapter also looks at starting Ajax from scratch by briefly introducing some of the many frameworks available in so many languages: Java, .NET, PHP, Perl, Ruby, Python, and so on.
The PHP language is probably one of the most ubiquitous and pervasive programming languages in use for web applications today, and it's what I used for all of the server-side components of the Ajax applications. The reasoning is that while some of you might know Python, and others Ruby, and still others .NET or Java, most people know PHP. Or if not, you can get up to speed with PHP more quickly than with the other languages. Plus, every web host I know of provides support for PHP.
Get Adding Ajax now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.