O'Reilly logo

Adding Ajax by Shelley Powers

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Old and New Persistence: Side by Side

A photo slideshow is probably one of the single-page applications most acceptable as a pure Ajax solution. It's not the type of thing one would expect to interact with using the browser's Back and Forward buttons, and it's not likely to have persistent links to any photo. Still, if users access a photo slideshow and have a browser extension like NoScript enabled, they will be faced with a blank page and will have to turn scripting on just to see what they're missing. No matter how nice the fades or the description pop-ups in the bottom, users come away a little less impressed than if the slideshow creator had just created the show using a traditional multipage approach and then added in the Ajax stuff. Not only will users with scripting disabled not be faced with a blank page when accessing the slideshow, the latter method also provides a way of managing the persistence problem that Ajax can add to a project.

The first slideshow, the photo slideshow, has been around quite some time, though most photo galleries and slideshows are managed via server-side code, not through Ajax (this is changing, quickly).

Implemented in PHP, an application like this would be given a collection of photos (usually in a subdirectory, but names listed in an array can also work). You can specify which photo to display by adding it as a GET HTTP request parameter, and also add these GET parameters as part of the URL to specify the Previous, Home, and Next links. These ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required