Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Ajax: The Definitive Guide
A Note Regarding Supplemental Files
Preface
Who Should Read This Book
Web Developers
Managers
How This Book Is Organized
Conventions Used in This Book
Using Code Examples
How to Contact Us
Safari® Books Online
Acknowledgments
I. Ajax Fundamentals
1. Reinventing the Web
Web Page Components
Classic Web Components
Ajax
Case Study
The application then
The application now
Modern Web Standards
XHTML
JavaScript
The DOM
Cascading Style Sheets (CSS)
XML
Syndication
RSS
Atom
XSLT
Browsers
Gecko
Trident
KHTML/WebCore
Presto
Others
Standards Compliance
Welcome to Web 2.0
2. From Web Sites to Web Applications
The Transition
Planning
Design
Implementation
Test and Release
Basic Web and Ajax Design Patterns
Client/Server
Basic Three-Tier
Model-View-Controller
Rich Internet Applications
Application Environments
Intranet
Commercial
Educational
Government
Specific Content
The Developer
What Ajax Is Not
3. Servers, Databases, and the Web
The Web Server
CGI
FastCGI
Servlets
SSI
Server-Side Scripting
ASP/ASP.NET
PHP
Python
Ruby
Java
Databases
Oracle
Microsoft SQL Server
IBM DB2
Open Source Databases: MySQL and PostgreSQL
Nonrelational Database Models
Getting Data Into and Out of Relational Databases
Interfacing the Interface
Frameworks and Languages
The .NET Framework
Ruby on Rails
Java Frameworks
Jakarta Struts
Spring
Tapestry
Python Frameworks
Django
Zope
PHP Frameworks
CakePHP
Zoop
Zend
What Good Are Frameworks?
4. Foundations: Scripting XML and JSON
XML
XML Requests and Responses
Parsing
XML in a String
XPath
XSLT
JSON
JSON Requests and Responses
Parsing
Choosing a Data Exchange Format
A Quick Introduction to Client Frameworks
The Dojo Toolkit
Prototype
script.aculo.us
moo.fx
DWR
jQuery
Sarissa
Others
Simplifying Development
Prototype Helper Functions
Prototype and Ajax
5. Manipulating the DOM
Understanding the DOM
We've Already Met
Manipulating DOM Elements, Attributes, and Objects
Creating Elements, Attributes, and Objects
Modifying and Removing Elements, Attributes, and Objects
Element, Attribute, and Object Information
Walking the DOM
Change That Style
Modifying and Removing Style
Style Information
What About Internet Explorer?
Events in the DOM
Creating Events
Initializing, Firing, Adding, and Removing Events
Event Information
What About Internet Explorer? Part II
DOM Stuff for Tables
Is innerHTML Evil?
6. Designing Ajax Interfaces
Usability
What Can Go Wrong?
Bloat, bloat, bloat
Poor focus
Obscurity
Lack of navigation
Expecting too much from your end users
Web reading style
Principles for the Ajax Web
Minimalist and aesthetic structure
Flexibility and efficiency
Consistency
Navigation
Feedback
Documentation and help
Functionality
Common Web Tools
Tools in a Desktop Application
What Can Be Done?
Visualization
Layout
Fonts
Images and Icons
Accessibility
W3C-WAI
Is This Important?
Ajax Accessibility Issues
When All Else Fails
The Ajax Interface
II. Ajax Foundations
7. Laying Out Site Navigation
Menus
Simple Navigation Bar
Button and Image Navigation
Advanced buttons
Image rollovers the Ajax way
Drop-Down Menus
The File Menu
Adding Ajax to the menu
Tabs
CSS to the Rescue
Image Tabs
The Tab Content
Navigation Aids
Breadcrumbs
Links at the Bottom
Paged Navigation
Navigation Boxes
Trees, trees, trees
Vertical lists
Accordion Navigation
Ajax and Page Loading
Problems with Ajax Navigation
Bookmarks
The Browser's Back Button
General Layout
8. Fun with Tables and Lists
Layout Without Tables
Old Layouts
Using CSS
Accessible Tables
Interacting with Tables
Ajax and Tables
Sorting Tables
JavaScript Sorting
Sorting with Ajax
And the Winner Is...
Tables with Style
Keeping Style with Sorts
Table Pagination
Making Pages with JavaScript
Ajax Table Pagination
Sorting Paginated Tables
Lists 2.0
What We've Already Seen
Lists for All Seasons
Table of Contents
Sortable Lists
Ajax and the Draggable List
An Ajax Slide Show
9. Page Layout with Frames That Aren't
Using Frames
The Frameset and Frame
The iframe Craze
XHTML and Frames
The Deprecated Ones
If Frames Are a Must
Using iframes As Frames
The Magic of Ajax and a DIV
Laying Out the "Frame"
Inserting Content
Page Layout
Think About Being Dynamic
The Proven Theory
Let CSS Be Your Guide
10. Navigation Boxes and Windows
The Alert Box
Integrating the Window
The Window Style
Moving the Window
Navigation Windows
Placing Content into Windows
Information Boxes
Replacing Alerts, Prompts, Confirms, and So On
Tool Tips
The Necessary Pop Up
11. Customizing the Client
Browser Customizations
Stylesheets
Font Sizes
Character Encoding
Stylesheet Switching
Creating the Stylesheets
Alternate Stylesheets
The Switching Object
Remembering the User's Selection
Switching Different Customizations
Easy Font-Size Switching
Using Relative Sizes
The Font CSS
A Font-Size Slider Bar
Creating Color Themes
Remember the Zen
The Rest Is the Same
Throwing Ajax into the Mix
Preparing the Structure for Change
Arrays to Store Ever-Changing Information
Changing Site Language with Ajax
The JSON to Send
Switching Out the Data
A Faster Alternative?
Repositioning Objects and Keeping Those Positions
Dragging Objects Around
Storing Information in a Database
Sending Changes with Ajax
Storing It All in the Database
12. Errors: To Be (in Style) or Not to Be
Error Handling on the Web
JavaScript Errors
Server-Side Errors
Server scripting errors
Database errors
External errors
Should I React to That Error?
Trapping an Error
try...catch...finally
Throwing an error
Ajax gone wrong
Ignorable Errors
Hold It Right There!
Handling an Error with Care
Notifying the User
Emailing the Developer
Logging to a Database
Integrating the User Error
Following Site Design
User Instructions for the Error
13. This Ain't Your Father's Animation
Animation on the Web
The History of the GIF Format
How Does It Work?
The file structure
Palettes
What Is Wrong with GIF?
Color Depth
Alpha Transparency
Building Animation with the PNG Format
What Is Different About a PNG?
The PNG CSS
JavaScript Looping
Putting It All Together
Adding Ajax to Our Animations
Ajax Animations
Frameworks Are the Way to Go
Dragging and Dropping
The script.aculo.us objects
Dojo Toolkit dragging
Dragging with other frameworks
Moving Objects
How frameworks do it
Other Animations on the Web
Object manipulations
Drawing libraries
14. A Funny Thing Happened on the Way to the Form
XHTML Forms
Form Elements
Accessible Forms
Accessibility
Usability
Using JavaScript
Getting Form Values
Simplicity with Prototype
Fancier Forms
CSS and Forms
More functional radio buttons and checkboxes
Fake drop downs
Using Libraries and Toolkits
Dojo
Zapatec
The Basics of Ajax and Forms
GET/POST Form Data Without Using the Form Submit
Accepting Ajax-Delivered Data
GET/POST/RAW POST
Email Form Data
Saving Form Data in a Database
Getting File Uploads
Sending Data Back to the Client
Server Responses
Reporting Success/Failure
Handling Other Server Responses
15. Data Validation: Client, Server, or Both
Data Validation Is Important
Validation with JavaScript
Value Checking
Using Regular Expressions
Specialized Data Checking
Phone numbers
Email addresses
Social Security numbers
Credit cards
A Validation Object
Using Libraries to Validate
CSS Notification of Errors
CSS Error Rules
JavaScript Rule Switching
Validation on the Server
Did We Get What We Expected?
Protecting the Database
Value Checking on the Server
Returning Problems
Ajax Client/Server Validation
On-the-Fly Checking
Client and Server Checking in One
III. Ajax in Applications
16. Search: The New Frontier
Types of Site Searches
Keyword Searching
Full Text Parsing
Page Indexing
Database searching
Search Engines for Local Use
Advanced Searching
Dynamic Searching with Ajax
Giving Hints
Sending Results to the Client
Googling a Site
Google's AJAX Search API
GSearchControl
GSearchForm
GwebSearch
Using Google's AJAX Search API
GwebResult
Displaying Results
The response
Site formatting
17. Introducing Web Services
What Is a Web Service?
Web Service Architectures
Remote Procedure Call
Service-Oriented Architecture
Web Service Standards
SOAP
Web Services Description Language
Universal Discovery, Description, and Integration
Representational State Transfer
Ajax and Web Services
Client Requests
Server-Side Scripting to Services
Gathering the Data
Sending the Web Service Response
Web Feeds
Scraping
Syndication
RSS and Atom
Feed Validation
Web Service APIs
18. Web Services: The APIs
Publicly Available Web Services
Blogging Services
Bookmark Services
Financial Services
Mapping Services
Music/Video Services
News/Weather Services
Photo Services
Reference Services
Search Services
Shopping Services
Other Services
Ajax and the API
XMLHttpRequest and the Web Service
The Next Step with Services
19. Mashups
Mashups in Web 2.0 Applications
What Are Mashups?
A Brief History
Mashups As Applications
Pitfalls and Travails
Just because
Clutter
Cohesiveness
Reinventing the wheel
What Mashups Can Do
Data Sources
Public Data
Public records
Background check records
Business records
People searches
Open Source Services
Application Portlets
Building a Mashup
Choose a Subject
Select Data Sources
Decide on the Backend
Code It
Mashups and Business
20. For Your Business Communication Needs
Businesses and Ajax
Reducing Costs
Easing Installation
Real-Time Communication
Client/Server Communication
Connecting to Chat
The Chat Client
The Chat Server
File Sharing
Sending a File
File Notification
Receiving the File
Whiteboards
The Board
Using an existing library
Collecting mouse movements
Drawing on the board
Communication
Sending the mouse movements
Drawing on other boards
Enhancing the Board
Pen colors
Stamps and shapes
Combining Applications
21. Internet Games Without Plug-ins
Gaming on the Web
First-Person Shooters
Strategy Games
Abstract
Real-time
Turn-based, economic, and God-like
Adventure Games
Role-Playing Games
Massive multiplayer online role-playing games
Puzzle Games
Arcade Games
Other Games
Internet Requirements
Plug-ins
Flash
Shockwave
Java applets
Game Development with Ajax
Animating a Character
Creating the Walking Loop
Moving the Character
Static directions
Dynamic directions
Basic Collisions
Rectangular Collision Detection
Circular Collision Detection
Linear Collision Detection
User Input
Keyboard Input
Mouse Input
The Basics of Event Handling
Handling User Input
Starts and Stops
Changes in Direction
Collisions
Receiving Data
Putting It All Together
IV. Wrapping Up
22. Modular Coding
What Is Modular Coding?
The Client Side
XHTML
Components of the page
Smaller pieces are better
CSS
Style properties
Media types
JavaScript
Functionality
Page-specific components
The Server Side
Using the Server Side for Structure
Modularizing SQL
Server-Side Components
23. Optimizing Ajax Applications
Site Optimization Factors
Size
Execution Speed
HTTP
HTTP Headers
HTTP Compression
Packets
Optimal Sizes
Client-Side Optimizations
XHTML and CSS
Size reduction
JavaScript
Size reduction
Code speed enhancements
Server-Side Optimizations
Compression
SQL Optimization
Inline queries
Stored procedures
Ajax Optimization
Communication
Data
Code Optimization
V. References
A. The XML and XSLT You Need to Know
What Is XML?
Anatomy of an XML Document
Elements and Attributes
Name Syntax
XML Namespaces
Well Formed
Comments and Processing Instructions
Entity References
Character References
Character Encodings
Unicode encoding schemes
Other character encodings
Validity
DTDs
Connecting DTDs to documents
Extensible Stylesheet Language Transformation
The Progression of XSL
The Stylesheet
Document declaration
XSLT Elements
<xsl:template>
<xsl:text>
<xsl:value-of>
<xsl:for-each>
<xsl:if>
<xsl:apply-templates>
The standard elements
Using functions
B. JavaScript Framework, Toolkit, and Library References
Prototype Framework Reference
Ajax with Prototype
Ajax Response Callbacks
Passing Parameters to the HTTP Method
Evaluating JSON
The Global Responders
Dynamic Page Updating
Automating Requests
script.aculo.us Library Reference
Auto-Completion
Ajax.Autocompleter
Autocompleter.Local
Autocompleter.Base
Inline Editing
Ajax.InPlaceEditor
Ajax.InPlaceCollectionEditor
Effects
Rico Library Reference
Ajax with Rico
The Response
Handling Responses
Effects
MooTools Library Reference
Simple Server Requests
Making an Ajax Request
Form Submission
Effects
Dojo Toolkit Reference
dojo.io.bind
Handling Results
JSON and Dot Notation
Sending Form Data
The Rest of Dojo
Sarissa Library Reference
Sarissa's Ajax Request
Parsing Data
Sarissa and XML
MochiKit Library Reference
MochiKit.Async
Ajax in MochiKit
The Rest of MochiKit
jQuery Library Reference
Ajax with jQuery
Other jQuery Functionality
C. Web Service API Catalog
D. Ajax Risk References
Requirements
Bookmarking Issues
Back and Forward Button Problems
Security Risks
Search Engines
Accessibility
Content Changes
Index
About the Author
Colophon
← Prev
Back
Next →
← Prev
Back
Next →