With the tremendous growth in Web usage comes a chal-
lenge to deliver Web-page content more efficiently and with
greater flexibility. This is desirable to serve adequately the
many users who still rely on relatively low-speed dial-up
Internet connections and to reduce the demand on Web
servers. Ajax (asynchronous JavaScript and XML) takes
advantage of several emerging Web-development technolo-
gies to allow Web pages to interact with users while keep-
ing the amount of data to be transmitted to a minimum.
In keeping with modern Web-design principles, the
organization of the Web page is managed by coding in
XHTML, a dialect of HTML that uses the stricter rules and grammar of the data-description markup language XML .Alternatively,
data can be stored directly in XML. A structure called
the DOM (Document Object Model; see dom) is used to
request data from the server, which is accessed through an
object called httpRequest. The “presentational” information
(regarding such matters as fonts, font sizes and styles, justi-
fication of paragraphs, and so on) is generally incorporated
in an associated cascading style sheet Behavior such as the presentation and processing
of forms or user controls is usually handled by a scripting
language. Ajax techniques tie
these forms of processing together so that only the part of
the Web page affected by current user activity needs to be
updated. Only a small amount of data needs to be received
from the server, while most of the HTML code needed to
update the page is generated on the client side—that is, in
the Web browser. Besides making Web pages more flexible
and interactive, Ajax also makes it much easier to develop
more elaborate applications, even delivering fully functional
applications such as word processing and spreadsheets over
the Web.
Some critics of Ajax have decried its reliance on Java-
Script, arguing that the language has a hard-to-use syntax
similar to the C language and poorly implements objects
. There is also a need
to standardize behavior across the popular Web browsers.
Nevertheless, Ajax has rapidly caught on in the Web devel-
opment community, filling bookstore shelves with books
on applying Ajax techniques to a variety of other languages.
Ajax can be simplified by providing a framework of
objects and methods that the programmer can use to set up
and manage the connections between server and browser.
Some frameworks simply provide a set of data structures
and function while
others include Ajax-enabled user interface components such
as buttons or window tabs. Ajax frameworks also vary in
how much of the processing is done on the server and how
much is done on the client (browser) side. Ajax frameworks
are most commonly used with JavaScript, but also exist for
Java (Google Web Toolkit), PHP, C++, and Python as well as
other scripting languages. An interesting example is Flap-
jax, a project developed by researchers at Brown University.
Flapjax is a complete high-level programming language that
uses the same syntax as the popular JavaScript but hides
the messy details of sharing and updating data between cli-
ent and server.
Drawbacks and Challenges
By their very nature, Ajax-delivered pages behave differ-
ently from conventional Web pages. Because the updated
page is not downloaded as such from the server, the
browser cannot record it in its “history” and allow the
user to click the “back” button to return to a previous
page. Mechanisms for counting the number of page views
can also fail. As a workaround, programmers have some-
times created “invisible” pages that are used to make the
desired history entries. Another problem is that since con-
tent manipulated using Ajax is not stored in discrete pages
with identifiable URLs, conventional search engines can-
not read and index it, so a copy of the data must be pro-
vided on a conventional page for indexing. The extent
to which XML should be used in place of more compact
data representations is also a concern for many devel-
opers. Finally, accessibility tools often do not work with Ajax-delivered
content, so an alternative form must often be provided to
comply with accessibility guidelines or regulations.
Despite these concerns, Ajax is in widespread use and
can be seen in action in many popular Web sites, including
Google Maps and the photo-sharing site Flickr.com.
0 comments:
Post a Comment