you are here 5
using ajax
So what makes a page “Ajax” ?
Ajax is a way of designing and building web pages that are as interactive and
responsive as desktop applications. So what does that mean for you? You
handle things at the client’s browser whenever you can. Your pages make
asynchronous requests that allow the user to keep working instead
of waiting for a response. You only update the things on your pages that
actually change. And best of all, an Ajax page is built using standard Internet
technologies, things you probably already know how to use, like:
Q:
Doesn’t Ajax stand for “Asynchronous JavaScript and
XML”?
A: Sort of. Since lots of pages that are considered “Ajax”
don’t use JavaScript or XML, it’s more useful to define Ajax as a
way of building web pages that are as responsive and interactive
as desktop applications, and not worry too much about the exact
technologies involved.
Q:
What exactly does “asynchronous” mean?
A:
In Ajax, you can make requests to the server without
making your user wait around for a response. That’s called an
asynchronous request, and it’s the core of what Ajax is all
about.
Q:
But aren’t all web pages asynchronous? Like when
a browser loads an image while I’m already looking at the
page?
A:Browsers are asynchronous, but the standard web page
isn’t. Usually when a web page needs information from a
server-side program, everything comes to a complete stop until
the server responds... unless the page makes an asynchronous
request. And that’ what Ajax is all about.
Q:
But all Ajax pages use that XMLHttpRequest object,
right?
A: Nope. Lots do, and we’ll spend a couple of chapters
mastering
XMLHttpRequest, but it’s not a requirement. In
fact, lots of apps that are considered Ajax are more about user
interactivity and design than any particular coding technique.
Ajax applications also use a few things that have been around for a while but
may be new to you, like:
We’ll look at all of
these in detail before
we’re through.
XHTML
Cascading Style Sheets
JavaScript
The XmlHttpRequest
XML & JSON
The DOM
An asynchronous
request is a
request that
occurs behind
the scenes.
Your users can
keep working
while the
request is
taking place.
Chapter 1. using ajax Page 5 Return to Table of Contents
Chapter 1. using ajax
Head First Ajax By Rebecca M. Riordan ISBN: 9780596515782 Publisher: O'Reilly Prepared for Ann Cherkis, Safari ID: maottw@gmail.com
written permission for reprints and excerpts from the publisher. Redistribution or other use that violates the fair use priviledge under U.S. copyright laws (see 17 USC107) or that
otherwise violates the Safari Terms of Service is strictly prohibited.