SlideShare a Scribd company logo
ppt14
AJAX
(Asynchronous JavaScript and
XML)• The term Ajax was coined on 18 February 2005 by Jesse
James Garrett in an article entitled "Ajax: A New Approach to
Web Applications", based on techniques used on Google
pages.
• On 5 April 2006, the World Wide Web Consortium (W3C)
released the first draft specification for the XMLHttpRequest
object in an attempt to create an official web standard.
• With an HTTP request, a web page can make a request to,
and get a response from a web server - without reloading the
page.
• The user will stay on the same page, and he or she will not
notice that scripts request pages, or send data to a server in
the background.
Ajax Applications
• Some prime examples of Web 2.0 are web sites such as
Google Maps and Flickr. Google Maps offers a highly
responsive user interface (UI). For instance, you can view a
map, then move your cursor across it to see adjacent areas
almost immediately.
• Other Web 2.0 sites provide a similarly rich user experience
by doing things such as integrating services from other web
sites or incorporating a steady stream of new information.
– For example, the Google map service can be brought into another
web site, such as a site for purchasing cars, to present a map that
highlights the location of auto dealerships that sell a particular car
model. The term used for these site integrations is "mashups“.
Characteristics of Conventional
Web Applications
• “Click, wait, and refresh” user interaction
– Page refreshes from the server needed for all
events, data submissions, and navigation
• Synchronous “request/response”
communication model
– The user has to wait for the response
• Page-driven: Workflow is based on pages
– Page-navigation logic is determined by the server
Source: Sang Shin, 18-week "Free" AJAX and Web 2.0 Programming (with Passion!)
Online Course, www.javapassion.com/ajaxcodecamp
Issues of Conventional Web
Application
• Interruption of user operation
– Users cannot perform any operation while waiting for a response
• Loss of operational context during refresh
– Loss of information on the screen
– Loss of scrolled position
• No instant feedback's to user activities
– A user has to wait for the next page
• Constrained by HTML
– Lack of useful widgets
• These are the reasons why Rich Internet Application (RIA)
technologies were born.
What is Ajax?
• Ajax can help increase the speed and usability
of an application's web pages by updating
only part of the page at a time, rather than
requiring the entire page to be reloaded after
a user-initiated change.
• Using Ajax, the pages of your application can
exchange small amounts of data with the
server without going through a form submit.
Source: http://java.sun.com/javaee/javaserverfaces/ajax/tutorial.jsp
The Ajax Technique
• The Ajax technique accomplishes this by using
the following technologies:
– JavaScript that allows for interaction with the
browser and responding to events.
– DOM for accessing and manipulating the structure of
the HTML of the page.
– XML which represents the data passed between the
server and client.
– An XMLHttpRequest object for asynchronously
exchanging the XML data between the client and the
server.
AJAX Request
Source: http://java.sun.com/javaee/javaserverfaces/ajax/tutorial.jsp
Why Ajax
• Interactive contents
• HTML and HTTP limitations
• Browser-based active contents?
Some alternatives and tradeoffs
Source: Creating an AJAX-Enabled Application, a Do-It-Yourself Approach, by Rick Palkovic and Mark Basler,
http://java.sun.com/developer/technicalArticles/J2EE/hands-on/legacyAJAX/do-it-yourself/index.html
Defining a Request Object
var request;
function getRequestObject() {
if (window.ActiveXObject) {
return(new ActiveXObject("Microsoft.XMLHTTP"));
} else if (window.XMLHttpRequest) {
return(new XMLHttpRequest());
} else {
return(null);
}
}
Source: J2EE training: http://courses.coreservlets.com
Handle Response
function handleResponse() {
if (request.readyState == 4) {
alert(request.responseText);
}
}
Source: J2EE training: http://courses.coreservlets.com
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 complete
Source: J2EE training: http://courses.coreservlets.com
HTML Code
• Use xhtml, not HTML 4
– In order to manipulate it with DOM
– <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN“
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">...</html>
– Due to IE bug, do not use XML header before the DOCTYPE
• Load the JavaScript file
– <script src="relative-url-of-JavaScript-file"
type="text/javascript"></script>
– Use separate </script> end tag
• Designate control to initiate request
– <input type="button" value="button label"
onclick="mainFunction()"/>
Source: J2EE training: http://courses.coreservlets.com
Dynamic Content from JSP or Servlet
Source: http://www.javareference.com/jrexamples/viewexample.jsp?id=111
Steps
• JavaScript
– Define an object for sending HTTP requests
– Initiate request
• Get request object
• Designate a request handler function
– Supply as onreadystatechange attribute of request
• Initiate a GET or POST request to a JSP page
• Send data
– Handle response
• Wait for readyState of 4 and HTTP status of 200
• Extract return text with responseText or responseXML
• Do something with result
• HTML
– Loads JavaScript from centralized directory
– Designates control that initiates request
– Gives ids to input elements that will be read by script
Initiate Request
function sendRequest(address) {
request = getRequestObject();
request.onreadystatechange =
showResponseAlert;
request.open("GET", address, true);
request.send(null);
}
Source: J2EE training: http://courses.coreservlets.com
Complete JavaScript Code
Source: J2EE training: http://courses.coreservlets.com
Interrupted and Uninterrupted
Operations
Interrupted user
operation while
the data is being
fetched
Uninterrupted
user operation
while data is
being fetched
Source: Sang Shin, 18-week "Free" AJAX and Web 2.0 Programming (with Passion!)
Online Course, www.javapassion.com/ajaxcodecamp
PHP Example
Client-side Code (HTML & Javascript)
Server-side Code
Ajax Example
Resources
• AJAX Tutorial, http://www.w3schools.com/ajax/
• Ajax: The Basics, Customized J2EE Training:
http://courses.coreservlets.com
• Ajax Design Strategies, Ed Ort and Mark Basler ,
http://java.sun.com/developer/technicalArticles/J2EE/AJAX/DesignStrategies/
• Creating an AJAX-Enabled Application, a Do-It-Yourself
Approach, by Rick Palkovic and Mark Basler,
http://java.sun.com/developer/technicalArticles/J2EE/hands-on/legacyAJAX/do-it-yourself/index.html
• Sang Shin, 18-week "Free" AJAX and Web 2.0 Programming
(with Passion!) Online Course, www.javapassion.com/ajaxcodecamp
• Including AJAX Functionality in a Custom JavaServer Faces
Component, by Gregory Murray and Jennifer Ball,
http://java.sun.com/javaee/javaserverfaces/ajax/tutorial.jsp

More Related Content

What's hot

Introduction to ajax
Introduction  to  ajaxIntroduction  to  ajax
Introduction to ajax
Pihu Goel
 
AJAX
AJAXAJAX
Ajax
AjaxAjax
Jquery Ajax
Jquery AjaxJquery Ajax
Jquery Ajax
Anand Kumar Rajana
 
Ajax ppt
Ajax pptAjax ppt
Ajax Introduction Presentation
Ajax   Introduction   PresentationAjax   Introduction   Presentation
Ajax Introduction Presentationthinkphp
 
Ajax PPT
Ajax PPTAjax PPT
Ajax PPT
Hub4Tech.com
 
Ajax presentation
Ajax presentationAjax presentation
Ajax presentation
Bharat_Kumawat
 
Using Ajax In Domino Web Applications
Using Ajax In Domino Web ApplicationsUsing Ajax In Domino Web Applications
Using Ajax In Domino Web Applicationsdominion
 
Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajax
Raja V
 
Ajax Presentation
Ajax PresentationAjax Presentation
Ajax Presentation
jrdoane
 
Architecture in Ajax Applications
Architecture in Ajax ApplicationsArchitecture in Ajax Applications
Architecture in Ajax Applications
Alois Reitbauer
 
An Introduction to Ajax Programming
An Introduction to Ajax ProgrammingAn Introduction to Ajax Programming
An Introduction to Ajax Programminghchen1
 
Ajax presentation
Ajax presentationAjax presentation
Ajax presentation
engcs2008
 
Ajax ppt - 32 slides
Ajax ppt - 32 slidesAjax ppt - 32 slides
Ajax ppt - 32 slides
Smithss25
 
Ajax Technology
Ajax TechnologyAjax Technology
Ajax Technology
Zia_Rehman
 

What's hot (20)

Introduction to ajax
Introduction  to  ajaxIntroduction  to  ajax
Introduction to ajax
 
Ajax
AjaxAjax
Ajax
 
AJAX
AJAXAJAX
AJAX
 
Ajax
AjaxAjax
Ajax
 
Ajax Ppt
Ajax PptAjax Ppt
Ajax Ppt
 
Ajax Presentation
Ajax PresentationAjax Presentation
Ajax Presentation
 
Jquery Ajax
Jquery AjaxJquery Ajax
Jquery Ajax
 
Ajax ppt
Ajax pptAjax ppt
Ajax ppt
 
Ajax Introduction Presentation
Ajax   Introduction   PresentationAjax   Introduction   Presentation
Ajax Introduction Presentation
 
Ajax PPT
Ajax PPTAjax PPT
Ajax PPT
 
Ajax presentation
Ajax presentationAjax presentation
Ajax presentation
 
Ajax.ppt
Ajax.pptAjax.ppt
Ajax.ppt
 
Using Ajax In Domino Web Applications
Using Ajax In Domino Web ApplicationsUsing Ajax In Domino Web Applications
Using Ajax In Domino Web Applications
 
Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajax
 
Ajax Presentation
Ajax PresentationAjax Presentation
Ajax Presentation
 
Architecture in Ajax Applications
Architecture in Ajax ApplicationsArchitecture in Ajax Applications
Architecture in Ajax Applications
 
An Introduction to Ajax Programming
An Introduction to Ajax ProgrammingAn Introduction to Ajax Programming
An Introduction to Ajax Programming
 
Ajax presentation
Ajax presentationAjax presentation
Ajax presentation
 
Ajax ppt - 32 slides
Ajax ppt - 32 slidesAjax ppt - 32 slides
Ajax ppt - 32 slides
 
Ajax Technology
Ajax TechnologyAjax Technology
Ajax Technology
 

Viewers also liked

Improve Your Product Portfolio Through Analytics - H. Del Castillo
Improve Your Product Portfolio Through Analytics - H. Del CastilloImprove Your Product Portfolio Through Analytics - H. Del Castillo
Improve Your Product Portfolio Through Analytics - H. Del Castillo
Hector Del Castillo, CPM, CPMM
 
Liothyronine 6893-02-3-api
Liothyronine 6893-02-3-apiLiothyronine 6893-02-3-api
Liothyronine 6893-02-3-api
Liothyronine-6893-02-3-api
 
Reactive applications
Reactive applicationsReactive applications
Reactive applications
Ashokkumar T A
 
підготовка до істипів
підготовка до істипівпідготовка до істипів
підготовка до істипівTamara Emec
 
Python base lezione 3
Python base lezione 3Python base lezione 3
Python base lezione 3
Annalisa Vignoli
 
Functions of an office
Functions of an officeFunctions of an office
Functions of an office
Hassanal Hayazi
 
Pip arc01015(architechtural &amp; building utilities design criteria)
Pip arc01015(architechtural &amp; building utilities design criteria)Pip arc01015(architechtural &amp; building utilities design criteria)
Pip arc01015(architechtural &amp; building utilities design criteria)
Muhammad Hassan
 
Reference Architecture Aviation
Reference Architecture AviationReference Architecture Aviation
Reference Architecture Aviation
Capgemini
 
Вимоги до компетентнісних результатів навчання у контексті підготовки до міжн...
Вимоги до компетентнісних результатів навчання у контексті підготовки до міжн...Вимоги до компетентнісних результатів навчання у контексті підготовки до міжн...
Вимоги до компетентнісних результатів навчання у контексті підготовки до міжн...
Александр Аиро
 
Інтеграція навчального процесу як чинник формування цілісної картини світу ...
Інтеграція навчального процесу як чинник формування  цілісної картини світу  ...Інтеграція навчального процесу як чинник формування  цілісної картини світу  ...
Інтеграція навчального процесу як чинник формування цілісної картини світу ...
Тамила Черепанова
 
Underwater welding
Underwater weldingUnderwater welding
Underwater welding
RAVI KUMAR
 
характеристика тесту
характеристика тестухарактеристика тесту
характеристика тесту
Inna Pavlova
 
методичні рекомендації укр.мова-зно
методичні рекомендації укр.мова-знометодичні рекомендації укр.мова-зно
методичні рекомендації укр.мова-зно
Tatyana Maslennikova
 
377 технологія критичного мислення на уроках укр м. л.
377 технологія критичного мислення на уроках укр м. л.377 технологія критичного мислення на уроках укр м. л.
377 технологія критичного мислення на уроках укр м. л.
shatalinskaya
 

Viewers also liked (14)

Improve Your Product Portfolio Through Analytics - H. Del Castillo
Improve Your Product Portfolio Through Analytics - H. Del CastilloImprove Your Product Portfolio Through Analytics - H. Del Castillo
Improve Your Product Portfolio Through Analytics - H. Del Castillo
 
Liothyronine 6893-02-3-api
Liothyronine 6893-02-3-apiLiothyronine 6893-02-3-api
Liothyronine 6893-02-3-api
 
Reactive applications
Reactive applicationsReactive applications
Reactive applications
 
підготовка до істипів
підготовка до істипівпідготовка до істипів
підготовка до істипів
 
Python base lezione 3
Python base lezione 3Python base lezione 3
Python base lezione 3
 
Functions of an office
Functions of an officeFunctions of an office
Functions of an office
 
Pip arc01015(architechtural &amp; building utilities design criteria)
Pip arc01015(architechtural &amp; building utilities design criteria)Pip arc01015(architechtural &amp; building utilities design criteria)
Pip arc01015(architechtural &amp; building utilities design criteria)
 
Reference Architecture Aviation
Reference Architecture AviationReference Architecture Aviation
Reference Architecture Aviation
 
Вимоги до компетентнісних результатів навчання у контексті підготовки до міжн...
Вимоги до компетентнісних результатів навчання у контексті підготовки до міжн...Вимоги до компетентнісних результатів навчання у контексті підготовки до міжн...
Вимоги до компетентнісних результатів навчання у контексті підготовки до міжн...
 
Інтеграція навчального процесу як чинник формування цілісної картини світу ...
Інтеграція навчального процесу як чинник формування  цілісної картини світу  ...Інтеграція навчального процесу як чинник формування  цілісної картини світу  ...
Інтеграція навчального процесу як чинник формування цілісної картини світу ...
 
Underwater welding
Underwater weldingUnderwater welding
Underwater welding
 
характеристика тесту
характеристика тестухарактеристика тесту
характеристика тесту
 
методичні рекомендації укр.мова-зно
методичні рекомендації укр.мова-знометодичні рекомендації укр.мова-зно
методичні рекомендації укр.мова-зно
 
377 технологія критичного мислення на уроках укр м. л.
377 технологія критичного мислення на уроках укр м. л.377 технологія критичного мислення на уроках укр м. л.
377 технологія критичного мислення на уроках укр м. л.
 

Similar to Ajax

Ajax workshop
Ajax workshopAjax workshop
Ajax workshop
WBUTTUTORIALS
 
Ajax tutorial by bally chohan
Ajax tutorial by bally chohanAjax tutorial by bally chohan
Ajax tutorial by bally chohan
WebVineet
 
Ajax
AjaxAjax
M Ramya
M RamyaM Ramya
ITI006En-AJAX
ITI006En-AJAXITI006En-AJAX
ITI006En-AJAX
Huibert Aalbers
 
Ajax
AjaxAjax
Ajax
AjaxAjax
AJAX.pptx
AJAX.pptxAJAX.pptx
AJAX.pptx
Ganesh Chavan
 
Ajax
AjaxAjax
Ajax Overview by Bally Chohan
Ajax Overview by Bally ChohanAjax Overview by Bally Chohan
Ajax Overview by Bally Chohan
WebVineet
 
Progressive Web Apps and React
Progressive Web Apps and ReactProgressive Web Apps and React
Progressive Web Apps and React
Mike Melusky
 
AJAX Introduction [Autosaved].pptx
AJAX Introduction [Autosaved].pptxAJAX Introduction [Autosaved].pptx
AJAX Introduction [Autosaved].pptx
Jobin86
 
Ajax
AjaxAjax
AJAX
AJAXAJAX

Similar to Ajax (20)

Ajax workshop
Ajax workshopAjax workshop
Ajax workshop
 
Ajax tutorial by bally chohan
Ajax tutorial by bally chohanAjax tutorial by bally chohan
Ajax tutorial by bally chohan
 
Ajax
AjaxAjax
Ajax
 
M Ramya
M RamyaM Ramya
M Ramya
 
ITI006En-AJAX
ITI006En-AJAXITI006En-AJAX
ITI006En-AJAX
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
AJAX.pptx
AJAX.pptxAJAX.pptx
AJAX.pptx
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
Ajax Overview by Bally Chohan
Ajax Overview by Bally ChohanAjax Overview by Bally Chohan
Ajax Overview by Bally Chohan
 
Progressive Web Apps and React
Progressive Web Apps and ReactProgressive Web Apps and React
Progressive Web Apps and React
 
Ajax Tuturial
Ajax TuturialAjax Tuturial
Ajax Tuturial
 
Mashup
MashupMashup
Mashup
 
AJAX Introduction [Autosaved].pptx
AJAX Introduction [Autosaved].pptxAJAX Introduction [Autosaved].pptx
AJAX Introduction [Autosaved].pptx
 
Ajax
AjaxAjax
Ajax
 
AJAX
AJAXAJAX
AJAX
 

More from Sanoj Kumar

Internet of things
Internet of thingsInternet of things
Internet of things
Sanoj Kumar
 
Jsp applet
Jsp appletJsp applet
Jsp applet
Sanoj Kumar
 
Corba
CorbaCorba
Dns
DnsDns
Big data and Internet
Big data and InternetBig data and Internet
Big data and Internet
Sanoj Kumar
 
A New Security Model For Distributed System
A New Security Model For Distributed SystemA New Security Model For Distributed System
A New Security Model For Distributed SystemSanoj Kumar
 
A New Form of Dos attack in Cloud
A New Form of Dos attack in CloudA New Form of Dos attack in Cloud
A New Form of Dos attack in CloudSanoj Kumar
 
Biometrics
BiometricsBiometrics
Biometrics
Sanoj Kumar
 
Inverted page tables basic
Inverted page tables basicInverted page tables basic
Inverted page tables basicSanoj Kumar
 
Hardware virtualization basic
Hardware virtualization basicHardware virtualization basic
Hardware virtualization basicSanoj Kumar
 
Dos attack basic
Dos attack basicDos attack basic
Dos attack basicSanoj Kumar
 
Steganography basic
Steganography basicSteganography basic
Steganography basicSanoj Kumar
 
Digital signatures
Digital signaturesDigital signatures
Digital signaturesSanoj Kumar
 

More from Sanoj Kumar (14)

Internet of things
Internet of thingsInternet of things
Internet of things
 
Jsp applet
Jsp appletJsp applet
Jsp applet
 
Corba
CorbaCorba
Corba
 
Dns
DnsDns
Dns
 
Big data and Internet
Big data and InternetBig data and Internet
Big data and Internet
 
A New Security Model For Distributed System
A New Security Model For Distributed SystemA New Security Model For Distributed System
A New Security Model For Distributed System
 
A New Form of Dos attack in Cloud
A New Form of Dos attack in CloudA New Form of Dos attack in Cloud
A New Form of Dos attack in Cloud
 
Biometrics
BiometricsBiometrics
Biometrics
 
IPC SOCKET
IPC SOCKETIPC SOCKET
IPC SOCKET
 
Inverted page tables basic
Inverted page tables basicInverted page tables basic
Inverted page tables basic
 
Hardware virtualization basic
Hardware virtualization basicHardware virtualization basic
Hardware virtualization basic
 
Dos attack basic
Dos attack basicDos attack basic
Dos attack basic
 
Steganography basic
Steganography basicSteganography basic
Steganography basic
 
Digital signatures
Digital signaturesDigital signatures
Digital signatures
 

Recently uploaded

CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSETECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
DuvanRamosGarzon1
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
Kamal Acharya
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
PrashantGoswami42
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
MuhammadTufail242431
 

Recently uploaded (20)

CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSETECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
 

Ajax

  • 2. AJAX (Asynchronous JavaScript and XML)• The term Ajax was coined on 18 February 2005 by Jesse James Garrett in an article entitled "Ajax: A New Approach to Web Applications", based on techniques used on Google pages. • On 5 April 2006, the World Wide Web Consortium (W3C) released the first draft specification for the XMLHttpRequest object in an attempt to create an official web standard. • With an HTTP request, a web page can make a request to, and get a response from a web server - without reloading the page. • The user will stay on the same page, and he or she will not notice that scripts request pages, or send data to a server in the background.
  • 3. Ajax Applications • Some prime examples of Web 2.0 are web sites such as Google Maps and Flickr. Google Maps offers a highly responsive user interface (UI). For instance, you can view a map, then move your cursor across it to see adjacent areas almost immediately. • Other Web 2.0 sites provide a similarly rich user experience by doing things such as integrating services from other web sites or incorporating a steady stream of new information. – For example, the Google map service can be brought into another web site, such as a site for purchasing cars, to present a map that highlights the location of auto dealerships that sell a particular car model. The term used for these site integrations is "mashups“.
  • 4. Characteristics of Conventional Web Applications • “Click, wait, and refresh” user interaction – Page refreshes from the server needed for all events, data submissions, and navigation • Synchronous “request/response” communication model – The user has to wait for the response • Page-driven: Workflow is based on pages – Page-navigation logic is determined by the server Source: Sang Shin, 18-week "Free" AJAX and Web 2.0 Programming (with Passion!) Online Course, www.javapassion.com/ajaxcodecamp
  • 5. Issues of Conventional Web Application • Interruption of user operation – Users cannot perform any operation while waiting for a response • Loss of operational context during refresh – Loss of information on the screen – Loss of scrolled position • No instant feedback's to user activities – A user has to wait for the next page • Constrained by HTML – Lack of useful widgets • These are the reasons why Rich Internet Application (RIA) technologies were born.
  • 6. What is Ajax? • Ajax can help increase the speed and usability of an application's web pages by updating only part of the page at a time, rather than requiring the entire page to be reloaded after a user-initiated change. • Using Ajax, the pages of your application can exchange small amounts of data with the server without going through a form submit. Source: http://java.sun.com/javaee/javaserverfaces/ajax/tutorial.jsp
  • 7. The Ajax Technique • The Ajax technique accomplishes this by using the following technologies: – JavaScript that allows for interaction with the browser and responding to events. – DOM for accessing and manipulating the structure of the HTML of the page. – XML which represents the data passed between the server and client. – An XMLHttpRequest object for asynchronously exchanging the XML data between the client and the server.
  • 9. Why Ajax • Interactive contents • HTML and HTTP limitations • Browser-based active contents?
  • 10. Some alternatives and tradeoffs Source: Creating an AJAX-Enabled Application, a Do-It-Yourself Approach, by Rick Palkovic and Mark Basler, http://java.sun.com/developer/technicalArticles/J2EE/hands-on/legacyAJAX/do-it-yourself/index.html
  • 11. Defining a Request Object var request; function getRequestObject() { if (window.ActiveXObject) { return(new ActiveXObject("Microsoft.XMLHTTP")); } else if (window.XMLHttpRequest) { return(new XMLHttpRequest()); } else { return(null); } } Source: J2EE training: http://courses.coreservlets.com
  • 12. Handle Response function handleResponse() { if (request.readyState == 4) { alert(request.responseText); } } Source: J2EE training: http://courses.coreservlets.com
  • 13. 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 complete Source: J2EE training: http://courses.coreservlets.com
  • 14. HTML Code • Use xhtml, not HTML 4 – In order to manipulate it with DOM – <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN“ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">...</html> – Due to IE bug, do not use XML header before the DOCTYPE • Load the JavaScript file – <script src="relative-url-of-JavaScript-file" type="text/javascript"></script> – Use separate </script> end tag • Designate control to initiate request – <input type="button" value="button label" onclick="mainFunction()"/> Source: J2EE training: http://courses.coreservlets.com
  • 15. Dynamic Content from JSP or Servlet Source: http://www.javareference.com/jrexamples/viewexample.jsp?id=111
  • 16. Steps • JavaScript – Define an object for sending HTTP requests – Initiate request • Get request object • Designate a request handler function – Supply as onreadystatechange attribute of request • Initiate a GET or POST request to a JSP page • Send data – Handle response • Wait for readyState of 4 and HTTP status of 200 • Extract return text with responseText or responseXML • Do something with result • HTML – Loads JavaScript from centralized directory – Designates control that initiates request – Gives ids to input elements that will be read by script
  • 17. Initiate Request function sendRequest(address) { request = getRequestObject(); request.onreadystatechange = showResponseAlert; request.open("GET", address, true); request.send(null); } Source: J2EE training: http://courses.coreservlets.com
  • 18. Complete JavaScript Code Source: J2EE training: http://courses.coreservlets.com
  • 19. Interrupted and Uninterrupted Operations Interrupted user operation while the data is being fetched Uninterrupted user operation while data is being fetched Source: Sang Shin, 18-week "Free" AJAX and Web 2.0 Programming (with Passion!) Online Course, www.javapassion.com/ajaxcodecamp
  • 21. Client-side Code (HTML & Javascript)
  • 24. Resources • AJAX Tutorial, http://www.w3schools.com/ajax/ • Ajax: The Basics, Customized J2EE Training: http://courses.coreservlets.com • Ajax Design Strategies, Ed Ort and Mark Basler , http://java.sun.com/developer/technicalArticles/J2EE/AJAX/DesignStrategies/ • Creating an AJAX-Enabled Application, a Do-It-Yourself Approach, by Rick Palkovic and Mark Basler, http://java.sun.com/developer/technicalArticles/J2EE/hands-on/legacyAJAX/do-it-yourself/index.html • Sang Shin, 18-week "Free" AJAX and Web 2.0 Programming (with Passion!) Online Course, www.javapassion.com/ajaxcodecamp • Including AJAX Functionality in a Custom JavaServer Faces Component, by Gregory Murray and Jennifer Ball, http://java.sun.com/javaee/javaserverfaces/ajax/tutorial.jsp