SlideShare ist ein Scribd-Unternehmen logo
1 von 18
August 05,2011   Raja.V
RECAP
ď‚— Classic Web application
ď‚— AJAX Basics
ď‚— Classic vs AJAX
ď‚— How AJAX Works ?
 “Click, wait, and refresh” user interaction
  - Page refreshes from the server needed for all events, data
  submissions, and navigation
  - The user has to wait for the response

 Synchronous “request/response” communication model
ď‚— Browser always initiates the request
ď‚— Uses HttpServletRequest
ď‚— Slow Response
ď‚— Excessive server load and bandwidth consumption
ď‚— Loss of operation context during refresh
 A…..J…….A……X
ď‚— AJAX is not a programming language/technology.
ď‚— Ajax is a design approach and a set of techniques
  for creating a highly interactive user experience for
  web applications.
ď‚— Makes Applications faster and user friendly.
ď‚— Google Maps
  - http://maps.google.com/
ď‚— Google Suggest
  - http://www.google.com/
ď‚— Gmail
  - http://gmail.com/
ď‚— AJAX uses XMLHttpRequest
ď‚— JavaScript communicates directly with the server, through
  the JavaScript XMLHttpRequest object .
ď‚— With an XMLHTTPRequest, a web page can make a
  request to, and get a response from a web server - without
  reloading the page.
AJAX Applications Are:
ď‚— 3-tier client/server apps
    Browser ↔ App Server ↔ Data Source
ď‚— Event driven
   ď‚— User clicks, user drags, user changes data
ď‚— Graphics Intensive
   ď‚— Visual Effects, Rich Visual Controls
ď‚— Are Data Oriented
   ď‚— Users are manipulating and entering data
ď‚— Are Complex
   ď‚— Pages hold many more controls and data than page-oriented
     applications
   ď‚— Multiple Master-Detail Relationships in one page
ď‚— onreadystatechange
ď‚— readyState
ď‚— status
ď‚— responseText
ď‚— responseXML
JavaScript
– Define an object for sending XMLHTTP requests
– Initiate request
  • Get request object
  • Designate a request handler function
     – Supply as onreadystatechange attribute of request
  • Initiate a GET or POST request
  • Send data
– Handle response
  • Wait for readyState of 4 and HTTP status of 200
  • Extract return text with response Text or responseXML
  • Do something with result

HTML
  – Loads JavaScript
  – Gives ids to input elements that will be read by script
var request;
function getRequestObject()
{
if (window.ActiveXObject) { //IE5, IE6
   return(new ActiveXObject("Microsoft.XMLHTTP"));
} else if (window.XMLHttpRequest) {//IE7+, Firefox,…
   return(new XMLHttpRequest());
} else {
   return(null);
}
}
function sendRequest() {
request = getRequestObject();
request.onreadystatechange = handleResponse;
request.open("GET", "message-data.html", true);
request.send(null);
}
function handleResponse()
{
if (request.readyState == 4 && request. status == 200) {
alert(request.responseText);
}
}
ď‚— AJAX ready states     ď‚— AJAX status
 0 - Uninitialized       200 - ok
 1 - Loading             404 – Page Not Found
 2 - Loaded
 3 - Processing
 4 - Request Finished
ď‚— Ajax: A New Approach to Web Applications
http://www.adaptivepath.com/publications/essays/archives/000385.php
ď‚— www.ajaxmatters.com
ď‚— www.ajaxian.com
ď‚— www.ajaxpatterns.org
Introduction to ajax

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Ajax presentation
Ajax presentationAjax presentation
Ajax presentation
 
PHP - Introduction to PHP AJAX
PHP -  Introduction to PHP AJAXPHP -  Introduction to PHP AJAX
PHP - Introduction to PHP AJAX
 
Ajax ppt - 32 slides
Ajax ppt - 32 slidesAjax ppt - 32 slides
Ajax ppt - 32 slides
 
Ajax
AjaxAjax
Ajax
 
Ajax and PHP
Ajax and PHPAjax and PHP
Ajax and PHP
 
Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajax
 
Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajax
 
Introduction to ajax
Introduction  to  ajaxIntroduction  to  ajax
Introduction to ajax
 
AJAX
AJAXAJAX
AJAX
 
Ajax PPT
Ajax PPTAjax PPT
Ajax PPT
 
Ajax ppt
Ajax pptAjax ppt
Ajax ppt
 
Asynchronous JavaScript & XML (AJAX)
Asynchronous JavaScript & XML (AJAX)Asynchronous JavaScript & XML (AJAX)
Asynchronous JavaScript & XML (AJAX)
 
Ajax
AjaxAjax
Ajax
 
Ajax Presentation
Ajax PresentationAjax Presentation
Ajax Presentation
 
Ajax Technology
Ajax TechnologyAjax Technology
Ajax Technology
 
Ajax
AjaxAjax
Ajax
 
Ajax and Jquery
Ajax and JqueryAjax and Jquery
Ajax and Jquery
 
Jquery Ajax
Jquery AjaxJquery Ajax
Jquery Ajax
 
Using Ajax In Domino Web Applications
Using Ajax In Domino Web ApplicationsUsing Ajax In Domino Web Applications
Using Ajax In Domino Web Applications
 
Ajax presentation
Ajax presentationAjax presentation
Ajax presentation
 

Ă„hnlich wie Introduction to ajax (20)

Ajax Tuturial
Ajax TuturialAjax Tuturial
Ajax Tuturial
 
Unit-5.pptx
Unit-5.pptxUnit-5.pptx
Unit-5.pptx
 
Ajax tutorial by bally chohan
Ajax tutorial by bally chohanAjax tutorial by bally chohan
Ajax tutorial by bally chohan
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
M Ramya
M RamyaM Ramya
M Ramya
 
Mashup
MashupMashup
Mashup
 
Ajax
AjaxAjax
Ajax
 
Core Java tutorial at Unit Nexus
Core Java tutorial at Unit NexusCore Java tutorial at Unit Nexus
Core Java tutorial at Unit Nexus
 
Ajax
AjaxAjax
Ajax
 
Ajax and xml
Ajax and xmlAjax and xml
Ajax and xml
 
AJAX
AJAXAJAX
AJAX
 
Ajax
AjaxAjax
Ajax
 
AJAX
AJAXAJAX
AJAX
 
AJAX.pptx
AJAX.pptxAJAX.pptx
AJAX.pptx
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 

KĂĽrzlich hochgeladen

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 

KĂĽrzlich hochgeladen (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

Introduction to ajax

  • 1. August 05,2011 Raja.V
  • 3. ď‚— Classic Web application ď‚— AJAX Basics ď‚— Classic vs AJAX ď‚— How AJAX Works ?
  • 4. ď‚— “Click, wait, and refresh” user interaction - Page refreshes from the server needed for all events, data submissions, and navigation - The user has to wait for the response ď‚— Synchronous “request/response” communication model ď‚— Browser always initiates the request ď‚— Uses HttpServletRequest
  • 5. ď‚— Slow Response ď‚— Excessive server load and bandwidth consumption ď‚— Loss of operation context during refresh
  • 6. ď‚— A…..J…….A……X ď‚— AJAX is not a programming language/technology. ď‚— Ajax is a design approach and a set of techniques for creating a highly interactive user experience for web applications. ď‚— Makes Applications faster and user friendly.
  • 7. ď‚— Google Maps - http://maps.google.com/ ď‚— Google Suggest - http://www.google.com/ ď‚— Gmail - http://gmail.com/
  • 8. ď‚— AJAX uses XMLHttpRequest ď‚— JavaScript communicates directly with the server, through the JavaScript XMLHttpRequest object . ď‚— With an XMLHTTPRequest, a web page can make a request to, and get a response from a web server - without reloading the page.
  • 9. AJAX Applications Are: ď‚— 3-tier client/server apps ď‚— Browser ↔ App Server ↔ Data Source ď‚— Event driven ď‚— User clicks, user drags, user changes data ď‚— Graphics Intensive ď‚— Visual Effects, Rich Visual Controls ď‚— Are Data Oriented ď‚— Users are manipulating and entering data ď‚— Are Complex ď‚— Pages hold many more controls and data than page-oriented applications ď‚— Multiple Master-Detail Relationships in one page
  • 10.
  • 11. ď‚— onreadystatechange ď‚— readyState ď‚— status ď‚— responseText ď‚— responseXML
  • 12. JavaScript – Define an object for sending XMLHTTP requests – Initiate request • Get request object • Designate a request handler function – Supply as onreadystatechange attribute of request • Initiate a GET or POST request • Send data – Handle response • Wait for readyState of 4 and HTTP status of 200 • Extract return text with response Text or responseXML • Do something with result HTML – Loads JavaScript – Gives ids to input elements that will be read by script
  • 13. var request; function getRequestObject() { if (window.ActiveXObject) { //IE5, IE6 return(new ActiveXObject("Microsoft.XMLHTTP")); } else if (window.XMLHttpRequest) {//IE7+, Firefox,… return(new XMLHttpRequest()); } else { return(null); } }
  • 14. function sendRequest() { request = getRequestObject(); request.onreadystatechange = handleResponse; request.open("GET", "message-data.html", true); request.send(null); }
  • 15. function handleResponse() { if (request.readyState == 4 && request. status == 200) { alert(request.responseText); } }
  • 16. ď‚— AJAX ready states ď‚— AJAX status 0 - Uninitialized 200 - ok 1 - Loading 404 – Page Not Found 2 - Loaded 3 - Processing 4 - Request Finished
  • 17. ď‚— Ajax: A New Approach to Web Applications http://www.adaptivepath.com/publications/essays/archives/000385.php ď‚— www.ajaxmatters.com ď‚— www.ajaxian.com ď‚— www.ajaxpatterns.org

Hinweis der Redaktion

  1. Instead of the traditional web application model where the browser itself is responsible for initiating requests to, and processing requests from, the web server, the Ajax model provides an intermediate layer — what Garrett calls an Ajax engine — to handle this communication. An Ajax engine is really just a JavaScript object or function that is called whenever information needs to be requested from the server. Instead of the traditional model of providing a link to another resource (such as another web page), each link makes a call to the Ajax engine, which schedules and executes the request. The request is done asynchronously, meaning that code execution doesn't wait for a response before continuing.
  2. •onreadystatechange: It contains the name of a function to be called automatically whenever the readyState property changes•readyState: It includes the status of the XMLHttpRequest and it changes from 0 to 4: •status: status 200 means "OK" and status 404 means "Page not found".•responseText: If the response from the server is not in XML format, use the responseText property. The responseText property returns the response as a string, and you can use it accordingly. •responseXML: If the response from the server is XML format, and you want to parse it as an XML object, use this property.