23-08-2012, 05:07 PM
AJAX
ajax.ppt (Size: 57 KB / Downloads: 33)
What is AJAX?
Asynchronous JavaScript and XML(AJAX)
Web development technique for creating web applications
Makes web pages more responsive by exchanging small amounts of data
Allows the web page to change its content without refreshing the whole page
A web browser technology independent of web server software
Benefits
Improves the user experience
Analyzing information typed into browser in real time
Provide a richer experience
Increases responsiveness of web pages
Improve bandwidth utilization
Only data which is required is retrieved from the server
How it works
AJAX runs in your browser
Works with asynchronous data transfers(HTTP requests) between the browser and the web server
Http requests are sent by javascript calls without having to submit a form
XML is commonly used as the format for receiving server data but plain text may be used as well
XMLHttpRequest object
A page element must make a javascript call
The javascript function must create an XMLHttpRequest object which is used to contact the server
Javascript must determine whether the client is IE or Firefox
http = new ActiveXObject("Microsoft.XMLHTTP"); (IE)
http = new XMLHttpRequest(); (Mozilla)
Sending the request
Once the XMLHttpRequest object has been created it must be set up to call the server
http.open("GET", serverurl, true);
http.onreadystatechange = jsMethodToHandleResponse;
http.send(null);
The code above utilizes the XMLHttpRequest object to contact the server and retrieve server data
When the response returns the javascript method jsMethodToHandleResponse can update the page
ajax.ppt (Size: 57 KB / Downloads: 33)
What is AJAX?
Asynchronous JavaScript and XML(AJAX)
Web development technique for creating web applications
Makes web pages more responsive by exchanging small amounts of data
Allows the web page to change its content without refreshing the whole page
A web browser technology independent of web server software
Benefits
Improves the user experience
Analyzing information typed into browser in real time
Provide a richer experience
Increases responsiveness of web pages
Improve bandwidth utilization
Only data which is required is retrieved from the server
How it works
AJAX runs in your browser
Works with asynchronous data transfers(HTTP requests) between the browser and the web server
Http requests are sent by javascript calls without having to submit a form
XML is commonly used as the format for receiving server data but plain text may be used as well
XMLHttpRequest object
A page element must make a javascript call
The javascript function must create an XMLHttpRequest object which is used to contact the server
Javascript must determine whether the client is IE or Firefox
http = new ActiveXObject("Microsoft.XMLHTTP"); (IE)
http = new XMLHttpRequest(); (Mozilla)
Sending the request
Once the XMLHttpRequest object has been created it must be set up to call the server
http.open("GET", serverurl, true);
http.onreadystatechange = jsMethodToHandleResponse;
http.send(null);
The code above utilizes the XMLHttpRequest object to contact the server and retrieve server data
When the response returns the javascript method jsMethodToHandleResponse can update the page