Technologies That Make Up Ajax
Ajax is, in itself, a combination of existing technologies. These include the following:
- XMLHttpRequest object
- JavaScript
- DHTML
- DOM
- XML
Let's briefly discuss each of them.
JavaScript is a scripting language developed initially by Netscape, but having the capability to be used on all known browsers. It is an interpreted language that can be used both on the client and server side as a scripting language. JavaScript can be easily used to interact with the HTML elements, validate user input, and manage your settings, such as the color and background color of different controls on a form. Like any other programming language, JavaScript contains variables, arrays, loops, functions, operators, exception handling in the form of "try" and "catch" statements, and so on. You can place your JavaScript code directly on the same HTML page or even in a separate .js file and link your web page with it.
All the HTML elements in your web page are organized in a Document Object Model, a W3C recommendation that every browser follows. This model describes how all the elements in an HTML page, such as input fields, paragraphs, images, anchors, and so on, are related to the topmost structure: the "document." This model defines the structure in a tree consisting of all the attributes and methods defined for an object in the document.
Fine, but what is DHTML? DHTML is the acronym for Dynamic Hypertext Markup Language, a technology that you can use to make your web page dynamic with the use of JavaScript. The word "dynamic" implies the capability of the browser to alter the look and style of HTML elements after the document has been loaded onto the browser. This dynamic content can be realized in several ways, either by applying properties to elements or by applying layers to a document.
CSS, or Cascading Style Sheets, are files that store the styles of your web page HTML elements. These files typically have the .css extension. Note that CSS is basically used to provide a customized look and feel to your HTML elements. You can use CSS files to store the formatting and style information of elements at a common place and then reuse it in your web forms to facilitate easy maintenance and enforce the consistency of the look and feel of the user interface elements.
As an example, you can store all the headings in all the web pages of an application by defining them as a class in the .css file. Later, if the heading style needs to be changed, you can do this just in one place—the .css file. The changes would be reflected across all web pages of your application wherever this class has been used.