Introduction To: By: Abhishek Rajpurohit
Introduction To: By: Abhishek Rajpurohit
AJAX
By:
ABHISHEK RAJPUROHIT
B.Tech. Final Yr. (CS)
12/10/2014
AJAX
JIET, Jodhpur
Introduction
Stands for Asynchronous JavaScript
and XML
Development technique for creating
interactive web applications
Not a new Technology but more of a
Pattern
12/10/2014
AJAX
Motivation NEEDs
WebPages can be UPDATED without
RELOADING.
Single piece of data can be loaded
without reloading of entire webpage
Multiple HTTP request/response can
be processed.
12/10/2014
AJAX
Roots of AJAX
Originally developed by Microsoft as
XMLHttp for IE 5.0.
Mozilla 1.0 had the first native
implementation of XMLHttpRequest in
2002.
Soon followed by Opera and others.
12/10/2014
AJAX
12/10/2014
AJAX
Web as a Platform
Collective Intelligence
Above the level of Single Device
Services , not packaged software
Rich User experiences
AJAX
Assists in User Interfaces
Less machine readable / linkable webpages
12/10/2014
AJAX
Auto completion
A specific portion of form data may be autocompleted as the user types.
12/10/2014
AJAX
HTML pages may poll data from a server for up-todate data such as scores, stock quotes, weather, or
application-specific data.
Sophisticated UI Controls
AJAX
Components
HTML (or XHTML) and CSS
Presenting information
XMLHttpRequest object
Retrieving data ASYNCHRONOUSLY from the web
server.
Javascript
Binding everything together
12/10/2014
AJAX
12/10/2014
AJAX
10
AJAX Architecture
Create an XMLHttpRequest object
Make a HTTP request to the server
Register your callback function for
handling the response
Handle the response, check for return
status
Parse the response on success, display
result
12/10/2014
AJAX
11
Using XMLHttpRequest
Transferring data to Server
Open() to initialize connection to Server
Send() to send the actual Data
METHOD
PATH
Example
CONNECTION
TYPE
requester.open("POST", "/query.cgi,true)
requester.send("name=Bob&email=bob@e
xample.com");
12/10/2014
AJAX
12
AJAX
13
0
1
2
3
4
Uninitialised
open
sent
receiving
Completed
Example
requester.onreadystatechange = stateHandler;
12/10/2014
AJAX
14
AJAX
15
Advantages
12/10/2014
AJAX
16
Problems
Breaking the back button
Browsers record static page visits
Cant see previous content of same page.
Invisible IFrames can invoke changes
that populate the history
AJAX
17
Problems Contd..
Increase in the code size on browser
Response time affected
Difficult to debug
Viewable Source
Server Load
12/10/2014
AJAX
18
dojo Toolkit
Google Web Toolkit
Microsoft Atlas
Prototype
Script.aculo.us
YUI
and a lot more ...
12/10/2014
AJAX
19
12/10/2014
AJAX
20
Reading Material
Overview
http://www.sitepoint.com/article/remote-scripting-ajax.html
http://www.mousewhisperer.co.uk/ajax_page.html
http://www.clearnova.com/ajax/
http://www.webpasties.com/xmlHttpRequest/
http://www.adaptivepath.com/publications/essays/archives/000385.php
Examples
http://en.wikipedia.org/wiki/AJAX
http://java.sun.com/developer/technicalArticles/J2EE/AJAX/index.html?cid=59754
http://www.ajaxreview.com/
http://ajaxblog.com/
Issues/Problems
http://sourcelabs.com/ajb/archives/2005/05/ajax_mistakes.html
12/10/2014
AJAX
21
Thank You
Questions ?
12/10/2014
AJAX
22