phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


AJAX - Client: XMLHttpRequest Object

Tag: AJAX, XMLHttpRequest   Category: PHP Application
post: 15 Mar 2008 read: 702


AJAX Client Side Step By Step Tutorial - part 6: XMLHttpRequest is the object that enable the JavaScript code to make asynchronous HTTP server request. With this, you can make HTTP requests, receive responses, and update parts of the page completely in the background, without any visual interruptions.

A simple version of the code that we will use for cross browser:


// creates XMLHttpRequest Instance
function createXmlHttpRequestObject(){

  // will store XMLHttpRequest object
  // at here
  var xmlHttp;

  // works all exceprt IE6 and older  
  try
  {
  
    // try to create XMLHttpRequest object
    xmlHttp = new XMLHttpRequest();    
  }
  catch(e)
  {
    // assume IE 6 or older
    try
    {
      xmlHttp = new ActiveObject("Microsoft.XMLHttp");
    }
    catch(e){ }
  }
  
  // return object or display error
  if (!xmlHttp)
    alert("Error creating the XMLHttpRequest Object");
  else
    return xmlHttp;
}


Series this article:
AJAX - Client Side: Techniques Introduction
AJAX - Client Side: JavaScript Overview
AJAX - Client Side: JavaScript and Document Object Model
AJAX - Client Side: JavaScript Events and the DOM
AJAX - Client Side: JavaScript, DOM, and CSS
AJAX - Client: XMLHttpRequest Object
AJAX - Client Side: Initiating Server Request Using XMLHttpRequest
AJAX - Client Side: Handling Server Response
AJAX - Client Side: Making Asynchronous Calls with XMLHttpRequest
AJAX - Client Side: Working with XML Structure
AJAX - Client Side: Processing XML Data use XMLHttpRequest
AJAX - Client Side: Simple Application for Process XML data

| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Chart: How to Build Cool Animation Real Time Chart
Joomla: Fast Road to Understand Component Programming
Email: Send Attachement Mail
mod_rewrite - Part 1: create your "fantasy" URL

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


619
posting