phpeveryday.com

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


AJAX - Client Side: Initiating Server Request Using XMLHttpRequest

Tag: Ajax, Client site, XMLHttpRequest, Server Request   Category:
post: 17 Mar 2008 read: 516


AJAX Client Side Step By Step Tutorial - part 7: After creating the XMLHttpRequest object, we will look what process that we can do. The key is understand object's methods and properties. We learn by practice.

Look sample code for processing like this:


function process()
{
  if(xmlHttp)
  {
    try
    {
      xmlHttp.open("Get","test.txt", true);
      xmlHttp.onreadystatechange = handleRequestStateChange;
      xmlHttp.send(null);
    }
    catch(e)
    {
      alert("Can't connect to server\n" + e.toString());
    }
  }
}

From the code, we see 2 methods:

  • open("method", "URL"[, asyncFlag[,"userName"[,"password"]]]) initialize the request parameters
  • send(content) Performs the HTTP Request

We see 1 property:

  • onreadystatechange Used to set the callback function that handles request state changes


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


615
posting