what is AJAX and How it works
pls ans

See All Responses Below...
Author
Message Rating
Posted on: 15/07/2013

AJAX stands for Asynchronous JavaScript And XML.

With AJAX, your JavaScript can communicate directly with the server, using the JavaScript XMLHttpRequest object. With this object, your JavaScript can trade data with a web server, without reloading the page.

With AJAX, your JavaScript can communicate directly with the server, using the JavaScript XMLHttpRequest object. With this object, your JavaScript can trade data with a web server, without reloading the page.

<html>

<body><script type="text/javascript">
function ajaxFunction(){
var xmlHttp;try  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }catch (e)  {
  // Internet Explorer
  try    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }  catch (e)    {
    try      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }    catch (e)      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
}} </script>

<form name="myForm">Name:

<input type="text" name="username" />

Time: <input type="text" name="time" />

</form></body></html>

 Explanation

First create a variable xmlHttp to hold the XMLHttpRequest object.

Then try to create the object with XMLHttp=new XMLHttpRequest(). This is for the Firefox, Opera, and Safari browsers.

 If that fails, try xmlHttp=new ActiveXObject("Msxml2.XMLHTTP") which is for Internet Explorer 6.0+, if that also fails, try xmlHttp=new ActiveXObject("Microsoft.XMLHTTP") which is for Internet Explorer 5.5+.

If none of the three methods work, the user has a very outdated browser, and he or she will get an alert stating that the browser doesn't support

AJAX - Sending a Request to the Server

To send off a request to the server, we use the open() method and the send() method.

The open() method takes three arguments. The first argument defines which method to use when sending the request (GET or POST).

The second argument specifies the URL of the

server-side script.

The third argument specifies that the request should be handled asynchronously.

The send() method sends the request off to the server

Posted on: 15/07/2013
Almost all web development packages including ASP.NET support AJAX..

Tom
Share this page across other social networking sites



Please Login to Post Your Comments
Name (Max. 100 characters)
Please post your comments here
Select Language
Comments
Attach File(Max. Size: 2 MB)
A few simple rules when posting your Comments,
  1. Please post only answers relevant to the topic of discussion.
  2. Please dont misuse this site or do not be abusive, offensive, inappropriate,harass anyone on the boards or post ads or spam. Doing so will delete your inappropriate messages and will block or delete your account on this site.