HTML DOM getElementById()
The getElementById() method returns a
reference to the first object with the
<h1 id="myHeader" onclick="getValue()">This is a header</h1>
<p>Click on the header to alert its value</p>
AJAX is a type of programming made popular in 2005.
AJAX is not a new programming language, but a new way to use
Not synchronized; that is, not occurring at
predetermined or regular intervals. The
term asynchronous is usually used to
describe communications in which data
can be transmitted intermittently rather
than in a steady stream.
For example, a telephone conversation is
asynchronous because both parties can
talk whenever they like. If the
communication were synchronous, each
party would be required to wait a specified
interval before speaking.
in object, XMLHttpRequest, to
communicate with a web server without
submitting a form or loading a page. It is
supported by most modern browsers.
The script creates an XMLHttpRequest
object and sends to the web server.
The server responds by sending the
contents of a file, or the output of a
When the response arrives from the
to act on the data.
Because the goal is a more responsive
user interface, the script usually displays
the data from the server using the DOM,
eliminating the need for a page refresh.
The server responds to the client
request by sending the contents of a file,
or the output of a server
Not limited to XML on the server side. Can
be a program running a language such as
PHP, Perl, ASP.net, ColdFusion or even a
program using GET or POST methods, the
same two ways and HTML form works.
In a GET request, the data is encoded in the
URL that loads the program. In a post
request, it is sent separately and can
contain more data.
Limitations of AJAX
The script and the XML data or server
program it requests data from must be on
the same domain.
IE 6 uses ActiveX to implement
XMLHttpRequest. Security settings in the
browser must be set to allow ActiveX.
Older browsers don’t support
Can compromise the accessibility of a site
for users with disabilities
Users unaccustomed to AJAX may have
AJAX is based on the XMLHttpRequest
Different browsers use different methods
to create the XMLHttpRequest object.
Internet Explorer 5 and IE 6 use an Active
Object, while other browsers use the built