AJAX is simply about JavaScript on the client (web browser) communicating with the server using XML. It is based on JavaScript and HTTP requests.



The Ajax web model is based on the traditional web model with changes to the transmitted message on the web server and the web browser.







What happens when the user submits a request?

When user submits request, the steps below occur sequentially:

1. Web browser requests for the content of just the part of the page that it needs.
2. Web server analyzes the received request and builds up an XML message, which is then sent back to the web browser.
3. Web browser receives the XML message. It parses the message in order to update the content of that part of the page.

AJAX uses JavaScript language through HTTP protocol to send/receive XML messages asynchronously to/from web server.

Note - Asynchronously means that data is not sent in a sequence.

An HTML page has two components as shown in the figure below:




Document Object Model (DOM):
• The W3C Document Object Model is a platform and language neutral interface that allows programs and scripts to dynamically access and update content,structure and style of a document


• The HTML DOM is the Document Object Model for HTML. The HTML DOM defines a standard set of objects for HTML and a standard way to access and manipulate HTML documents


• The HTML DOM views HTML documents as a tree structure of elements. All elements,along with their text and attributes,can be accessed and manipulated through the DOM tree


• The HTML code below shows DOM Body,Form and Input objects. The Input objects are embedded in the Form and the Form is embedded in the Body object


Javascript
JavaScript is a scripting language that is supported and runs on almost all web browsers,such as Internet Explorer,Mozilla,Firefox,Nestcape and Opera.

· JavaScript was designed to add interactivity to HTML pagesBy embedding JavaScript in an HTML page,parts of the Document Object Model (DOM) within the HTML document can be updated.


0 comments