Tag Archive | "xmlhttprequest"

Tags: , , , ,

Creating an XMLHttpRequest Object

Posted on 05 February 2012 by Moki

Browsers IE7+, Firefox, Chrome, Safari and Opera at this point have built in what is called the XMLHttpRequest object. This XMLHttpRequest object is used to send a receive data with a server in the background making it possible to update sections of a web page without reloading the browser window.

Proper Syntax for creating an XMLHttpRequest Object:

variable=new XMLHttpRequest();

Example of an XMLHttpRequest Object being used:

var xmlhttp;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();

This XMLHttpRequest object is backbone of AJAX and is used extensively with the AJAX method.

Comments (0)

Tags: , , , , , , ,

What is AJAX and how does it Work?

Posted on 05 February 2012 by Moki

First thing that you need to know about Ajax is that it is to be used by those that already have at least some working knowledge of HTML/XHTML, CSS and Javascript/DOM. Ajax stands for “Asynchronous Javascript and XML and is a not a language but technique used to create dynamic and fast webpages.

Ajax allows a developer to create pages that are updated asyncronously by sending and recieving small amounts of data through the server in the background. This means you can reload data on the page without actually reloading the page itself. Some examples of sites that use AJAX to create this type of features are Google Maps, Youtube and Facebook tabs. In fact the AJAX method was made popular in 2005 being used with Google Suggest.

How does AJAX work?

  1. Browser creates an XMLHttpRequest object and sends it
  2. Server processes the HTTPRequest, creates a response and sends the new data back to the browser
  3. Browser processes the returned data using Javascript and updates the pages content.

Keep in mind that AJAX applications are ran within the browser and are OS independant. AJAX uses internet standards and uses a combination of XMLHttpRequest objects to exchange the data as stated above, Javascript/DOM to display and interact with the information, CSS to style the data and XML generally is used as the format to transfer the data.

Comments (0)