My Thoughts & Views

AJAX Quick Glance :Pat2

Posted on: July 19, 2007

How it Works?

Ajax uses a programming model with display and events. These events are user

actions, they call functions associated to elements of the web page.
Interactivity is achieved with forms and buttons. DOM allows to link elements of

the page with actions and also to extract data from XML files provided by the


To get data on the server, XMLHttpRequest provides two methods:
– open: create a connection.
– send: send a request to the server.
Data furnished by the server will be found in the attributes of the XMLHttpRequest

– responseXml for an XML file or
– responseText for a plain text.

Note:a new XMLHttpRequest object has to be created for each new file to load.

We have to wait for the data to be available to process it, and in this purpose,

the state of availability of data is given by the readyState attribute of


States of readyState follow (only the last one is really useful):
0: not initialized.
1: connection established.
2: request received.
3: answer in process.
4: finished.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: