Presented By: Guided By:: Anagha.D.Kulkarni Prof. P.S.Revankar
Presented By: Guided By:: Anagha.D.Kulkarni Prof. P.S.Revankar
Presented By : Guided By :
Anagha.D.Kulkarni Prof. P.S.Revankar
What is AJAX ?
1. Continuous Feel
3. Graphical Interaction
4. Language Neutrality
AJAX is Not
1. Proprietary
2. Plug-in-Based
3. Browser Specific
How AJAX Works?
How AJAX Works?
XMLHttpRequest Object
An Example
<html>
<body><form name="myForm">
Name: <input type="text"
name="username" />
Time: <input type="text"
name="time" />
</form></body>
</html>
XMLHttpRequest Object
<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");
}
XHR Object
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>
XHR Object Methods
1. abort()
2. getAllResponseHeaders()
3. getResponseHeader(headerName)
4. open(method, URL)
open(method, URL, async)
open(method, URL, async, userName)
open(method, URL, async, userName, password)
XHR Object Properties
1. responseText
2. responseXML
3. responseBody
4. status
5. statusText
Traditional Web Application
1. First, the application shows a list of employees to pick from
Traditional Web Application
2. When the user chooses an employee, the server
returns a new page (FIRST REFRESH) and a form is
displayed
Traditional Web Application
3. The user can then edit the employee data (e.g, change
"Andrew" to "Andy") and submit the form. The server then
returns the new page (SECOND REFRESH).
Traditional Web Application
4. To get back to the employee list to begin the process of
modifying another employee's data, the user would have
to click on the "Employee List" link (THIRD REFRESH).
AJAX Web Application
1. Like with the traditional method, the Ajax
application shows a list of employees to pick from.
AJAX Web Application
2. When the user chooses an employee, the page doesn't
reload. Instead, an Ajax call to the server is made, the
server returns the HTML form and JavaScript is used to
display the form on the page.
AJAX Web Application
3. The user can then edit the form fields. Each time a
changed form field loses focus the change is sent to the
server with Ajax, the server-side code updates the data in
the database and sends back the updated list of employees
to the browser. JavaScript is again used to display the
updated list on the page
AJAX Web Application
4. The employee list is updated to reflect the changes
made. Notice "Andrew" has been changed to "Andy" in
the list. A message is displayed letting the user know that
the database was updated
Moral
•No need to Refresh
page.
•Real Time
•High speed
•Less Bandwidth
usage
Advantages
Using Ajax, a web application can request only the
content that needs to be updated, thus drastically
reducing bandwidth usage.
Ajax has it’s costs, and is not a panacea for all Web site / application
‘problems’
We need to know and experiment with it, to keep up with the neighbors
Web 2.0 is more about the cultural wave that Ajax is a part of
Need to keep track of Web 2.0 too, as it may change how our customers
expect us to offer services
References
http://webdesign.about.com/od/ajax
http://en.wikipedia.org/wiki/AJAX
http://www.w3schools.com/Ajax
Questions
? ? ?
?
? ?
?
Thank You !