AJAX - What is AJAX?


AJAX - What is AJAX?

Ajax : Asynchronous JavaScript and XML, Ajax Benefits :

  • Client-side java script to promote quick page refresh.
  • Aids in dynamic page updates.
  • Enables background data downloads.
  • Provides rich and user-friendly display of sites.

AJAX is based on internet standards, and uses a combination of :

  • XMLHttpRequest object (to access data from a web server)
  • JavaScript/DOM (to display the accessed data in a structured manner)

1. XMLHttpRequest object in Ajax

  • Below listed are few methods and properties of XMLHttpRequest object that’s helps in web page partial updates.

Methods in Ajax :

  • abort, 
  • getAllResponseHeaders, 
  • getResponseHeader, 
  • open, 
  • send,
  • setRequestHeader

Properties :

  • onreadystatechange,
  • readyState, 
  • responseText, 
  • responseXML,
  • status, 
  • statusText

IE5 and IE6 do not follow the latest ajax standards but, has its own ActiveXObject. They are

  1. synchronous - text
  2. asynchronous - text 
  3. asynchronous - with Prototype 
  4. asynchronous - with XML

2. DOM (to display/use the data)

  • Document Object Model (DOM), the programming interface for HTML and XML files that offers a structured notation of the data and the methodology to access those data. It delivers a depiction of the data as a structured collection of nodes and objects that have properties and methods. It also joins web pages to scripts and required programming languages.