AJAX stands for Asynchronous JavaScript and XML.
AJAX is a new technique for creating better, faster, and more interactive web applications with the help of XML, HTML, CSS, and Java Script
Before you start ajax you will be much and more knowledge about javascript,its important for us.ajax is not difficult it can be easily implementation.
Following advantage of ajax call :
1-Speed,
2-Interaction,
3-XMLHttpRequest,
4-Asynchronous call,
5-Form Validation,
6-Bandwidth Usage,
What is XMLHttpRequest(XHR) :
The XMLHttpRequest object is used to exchange data with a server behind the scenes,
Its part of web pages,without reloading whole page.
It has been available ever since Internet Explorer 5.5 was released in July 2000.
XMLHttpRequest (XHR) is an API that can be used by JavaScript, JScript, VBScript, and other web browser scripting languages to transfer and manipulate XML data to and from a webserver using HTTP, establishing an independent connection channel between a webpage's Client-Side and Server-Side.
XHR request is exchange using XHR object.
The intent is to make web pages feel more responsive by exchanging small amounts of data with the server behind the scenes, so that the entire web page does not have to be reloaded each time the user makes a change. This is meant to increase the web page's interactivity, speed, and usability
XHR method :
1- abort(),
2-getAllResponseHeaders(),
3-getResponseHeader( headerName ),
Creating the Object :
var XmlHttp = new XMLHttpRequest();
XMLHttpRequest Properties
onreadystatechange
An event handler for an event that fires at every state change.
readyState
The readyState property defines the current state of the XMLHttpRequest object.
The following table provides a list of the possible values for the readyState property:
0-The request is not initialized.
1-The request has been set up.
2-The request has been sent.
3-The request is in process.
4-The request is completed.
readyState = 0 After you have created the XMLHttpRequest object, but before you have called the open() method.
readyState = 1 After you have called the open() method, but before you have called send().
readyState = 2 After you have called send().
readyState = 3 After the browser has established a communication with the server, but before the server has completed the response.
readyState = 4 After the request has been completed, and the response data has been completely received from the server.
responseText
Returns the response as a string.
responseXML
Returns the response as XML. This property returns an XML document object, which can be examined and parsed using the W3C DOM node tree methods and properties.
status
Returns the status as a number (e.g., 404 for "Not Found" and 200 for "OK").
statusText
Returns the status as a string (e.g., "Not Found" or "OK").
AJAX Disadvantages
1-Open Source: View source is allowed and anyone can view the code source written for AJAX,
2-It can increase design and development time,
3-Security is less in AJAX application as all files are downloaded at client side.
Comments