SlideShare una empresa de Scribd logo
1 de 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

Más contenido relacionado

La actualidad más candente (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
 

Similar a 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
 

Último

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 

Último (20)

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 

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

Notas del editor

  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.