Skip to Main Content
Adding Ajax
book

Adding Ajax

by Shelley Powers
June 2007
Intermediate to advanced content levelIntermediate to advanced
400 pages
9h 52m
English
O'Reilly Media, Inc.
Content preview from Adding Ajax

The Reengineered Clients

The biggest decision at this point is whether to implement the server-side application and the Ajax client within the same pages. This was the approach used in Chapter 7, but it doesn't always provide the best value for an application.

There are times when a user may have scripting enabled, but would choose to work with the nonscript-enabled version of an application. People using screen readers would most likely prefer the nonscripted version, but may still have scripting turned on. After all, not all scripting pushes elements in the page around. Then there are folks using some oddball browser that does strange things to the page, or others who really aren't fond of Ajax (No! How can that be!), and it's nice to be able to give all these web page readers a choice.

The Script-Free Application

Both the scripting and nonscripting versions of the application are served from the same intro page, which uses PHP to list out all the links to the "static" photo pages (effectively caching the Flickr request to get the original set of photos), as well as providing a link to the slideshow. The links pass all the information necessary to populate the page in the server-side application, including the photo identifier and other identifying information for the image URL. Example 9-11 includes the code for this page.

Example 9-11. Nonscript-dependent introduction page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Ajax: The Definitive Guide

Ajax: The Definitive Guide

Anthony T. Holdener III
Ajax Design Patterns

Ajax Design Patterns

Michael Mahemoff
Web Development with JavaScript and Ajax Illuminated

Web Development with JavaScript and Ajax Illuminated

Richard Allen, Kai Qian, Lixin Tao, Xiang Fu

Publisher Resources

ISBN: 9780596529369Supplemental ContentErrata Page