AJAXweb Yenyewe Important Notes
AJAXweb Yenyewe Important Notes
Applications
Web applications are easy and inexpensive to deliver. With web applications, a company can reduce the costs
of the IT department that is in charge of installing the software on the users' machines. With web
applications, all that users need is a computer with a working web browser and an Internet or intranet
connection.
Web applications are easy and inexpensive to upgrade. Maintenance costs for software have always been
significant. Because upgrading an existing piece of software is similar to installing a new one, the web
applications' advantages mentioned above apply here as well. As soon as the application on the server
machine is upgraded, everyone gets the new version.
Web applications have flexible requirements for the end users. Just have your web application installed on
a serverany modern operating system will doand you'll be able to use it over the Internet/Intranet on
any Mac, Windows, or Linux machine and so on. If the application is properly built, it will run equally well
on any modern web browser, such as Internet Explorer, Mozilla Firefox, Opera, or Safari.
Web applications make it easier to have a central data store. When you have several locations that need
access to the same data, having all that data stored in one place is much easier than having separate
databases in each location. This way you avoid potential data synchronization operations and lower security
risks.
HTTP is supported by all web browsers, and it does very well the job it was
conceived forretrieving simple web content. Whenever you request a web page
using your favorite web browser, the HTTP protocol is assumed. So, for example,
when you type www.mozilla.org in the location bar of Firefox, it will assume by
default that you meant http://www.mozilla.org.
The standard document type of the Internet is HyperText Markup Language (HTML), and
it is built of markup that web browsers understand, parse, and display. HTML is a language
that describes documents' formatting and content, which is basically composed of static text
and images.
Example
Web Client
Web Server
N.B HTTP transactions always happen between a web client (the software making the request, such as a web
browser) and a web server (the software responding to the request, such as Apache or IIS).
2. The user is the person using the client.
3. Even if HTTP (and its secure version, HTTPS) is arguably the most important protocol
used on the Internet, it is not the only one. Various kinds of web servers use different
protocols to accomplish various tasks, usually unrelated to simple web browsing.
The technologies that enable the Web to act smarter are grouped in the following two main
categories:
Client-side technologies enable the web client to do more interesting things than displaying static documents.
Usually these technologies are extensions of HTML, and don't replace it entirely.
Server-side technologies are those that enable the server to store logic to build web pages on the fly.
AJAX is about reaching a better balance between client functionality and server
functionality when executing the action requested by the user. Up until now, client-side
functionality and server-side functionality were regarded as separate bits of functionality
that work one at a time to respond to user's actions. AJAX comes with the solution to balance
the load between the client and the server by allowing them to communicate in the
background while the user is working on the page.
AJAX is made of the following:
JavaScript is the essential ingredient of AJAX, allowing you to build the client-side functionality. In your
JavaScript functions you'll make heavy use of the Document Object Model (DOM) to manipulate parts of
the HTML page.
The XMLHttpRequest object enables JavaScript to access the server asynchronously, so that the user can
continue working, while functionality is performed in the background. Accessing the server simply means
making a simple HTTP request for a file or script located on the server. HTTP requests are easy to make
and don't cause any firewall-related problems.
A server-side technology is required to handle the requests that come from the JavaScript client. In this book
we'll use PHP to perform the server-side part of the job.
AJAX brings you the following potential benefits when building a new web application:
It makes it possible to create better and more responsive websites and web applications.
Because of its popularity, it encourages the development of patterns that help developers avoid reinventing the
wheel when performing common tasks.
It makes use of existing technologies.
It makes use of existing developer skills.
Features of AJAX integrate perfectly with existing functionality provided by web browsers (say, redimensioning the page, page navigation, etc).
Common scenarios where AJAX can be successfully used are:
Enabling immediate server-side form validation, very useful in circumstances when it's unfeasible to transfer
to the client all the data required to do the validation when the page initially loads. Chapter 4 contains a
form validation case study.
Creating simple online chat solutions that don't require external libraries such as the Java Runtime Machine or
Flash. You'll build such a program in Chapter 5.
Building Google Suggest-like functionality, like an example you'll build in Chapter 6.
More effectively using the power of other existing technologies. In Chapter 7, you'll implement a real-time
charting solution using Scalable Vector Graphics (SVG), and in Chapter 10, you'll use an external AJAX
library to create a simple drag-and-drop list.
Coding responsive data grids that update the server-side database on the fly. You'll create such an application
in Chapter 8.
Building applications that need real-time updates from various external sources. In Chapter 9, you'll create a
simple RSS aggregator.