SlideShare a Scribd company logo
1 of 15
Ajax!  Presented Venkat Krishnan
What is Ajax  •  standards-based presentation using XHTML and CSS  •  dynamic display and interaction using the Document Object Model •  data interchange and manipulation using XML and XSLT  •  asynchronous data retrieval using XMLHttpRequest  •  and JavaScript binding everything together  2
Classic vs. Ajax  3
Async Communication 4
5
Examples of AJAX  •  GMail  •  Google Maps  •  Google Suggest •  Flickr  6
Is it new?  •  Not Really  •  Hidden Frames  - IE5+, Mozilla 1.0+, Opera 7.6+  •  Java  -  Applets  7
Why is it popular?  •  Google helped popularize, and legitimize it in GMail  •  Increase Usability of Web Applications  •  Rich Internet Applications without Flash  •  Save Bandwidth  •  Download only data you need  •  Faster interfaces (sometimes)  8
Why is it bad?  •  Breaks back button support  •  URL's don't change as state changes  •  Cross Browser Issues can be a pain  •  JavaScript may tax older machines CPU  •  Can't access domains other than the calling domain  •  May be disabled (for security reasons) or not available on some browsers  •  Debugging is difficult  9
XMLHttpRequest  •  A JavaScript Class that lets you make asynchronous HTTP requests from JavaScript  •  Make an HTTP request from a JavaScript event  •  A call back JavaScript function is invoked at each state of the HTTP request and response  10
XMLHttpRequest Properties •  onreadystatechange - call back function for state changes  •  readyState - the current state of the HTTP call  •  responseText - the text result of the request  •  responseXML - DOM xml object from the request  •  status - HTTP status code of the response  •  statusText - HTTP status text  11
XMLHttpRequest Example if (window.XMLHttpRequest) { var req = new XMLHttpRequest(); req.onreadystatechange = requestStateHandler;  req.open("GET", "/somefile.xml", true); req.send("");  }  function requestStateHandler() { if (req.readyState == 4) { //response ready alert(req.statusText);  }  }  12
IE does it differently  •  The above example however won't work on IE  req = new  ActiveXOjbect("Microsoft.XMLHTTP");  •  You can't totally blame them because they invented it  •  Native XMLHttpRequest support should be in IE7  13
Cross Browser AJAX  var req;  function loadXMLDoc(url) { req = false;  // branch for native XMLHttpRequest object if(window.XMLHttpRequest) {  try {  req = new XMLHttpRequest();  } catch(e) {  req = false;  }  // branch for IE/Windows ActiveX version } else if(window.ActiveXObject) { try {  req = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) {  try {  req = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {  req = false;  }  }  }  if(req) {  req.onreadystatechange = processReqChange; req.open("GET", url, true);  req.send("");  }  }  14
Flash vs AJAX •  No plugin for AJAX  •  Flash development tools cost money  •  Flash typically has slower page load time  •  Flash can work on older browsers •  ActionScript doesn't have a cross browser issues  •  Flash can access other domains if there is a crossdomain.xml file  15

More Related Content

What's hot

What is Ajax technology?
What is Ajax technology?What is Ajax technology?
What is Ajax technology?JavaTpoint.Com
 
Pracitcal AJAX
Pracitcal AJAXPracitcal AJAX
Pracitcal AJAXjherr
 
Ajax basics
Ajax basicsAjax basics
Ajax basicsVel004
 
Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajaxNir Elbaz
 
Spring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
Spring I/O 2012: Natural Templating in Spring MVC with ThymeleafSpring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
Spring I/O 2012: Natural Templating in Spring MVC with ThymeleafThymeleaf
 
Advanced web application architecture - Talk
Advanced web application architecture - TalkAdvanced web application architecture - Talk
Advanced web application architecture - TalkMatthias Noback
 
Jisse Reitsma 123betaal
Jisse Reitsma 123betaalJisse Reitsma 123betaal
Jisse Reitsma 123betaalGuido X Jansen
 
Computers & Technology :: Extracting Data from an AJAX-enabled Web Site
Computers & Technology :: Extracting Data from an AJAX-enabled Web SiteComputers & Technology :: Extracting Data from an AJAX-enabled Web Site
Computers & Technology :: Extracting Data from an AJAX-enabled Web Sitegustyebb5222
 
Shootout! template engines on the jvm
Shootout! template engines on the jvmShootout! template engines on the jvm
Shootout! template engines on the jvmNLJUG
 
Ajax Presentation
Ajax PresentationAjax Presentation
Ajax Presentationjrdoane
 
GraphQL-PHP: Dos and don'ts
GraphQL-PHP: Dos and don'tsGraphQL-PHP: Dos and don'ts
GraphQL-PHP: Dos and don'tsVáclav Šír
 

What's hot (20)

What is Ajax technology?
What is Ajax technology?What is Ajax technology?
What is Ajax technology?
 
Pracitcal AJAX
Pracitcal AJAXPracitcal AJAX
Pracitcal AJAX
 
Ajax basics
Ajax basicsAjax basics
Ajax basics
 
Ajax technology
Ajax technologyAjax technology
Ajax technology
 
Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajax
 
Ajax
AjaxAjax
Ajax
 
ITI006En-AJAX
ITI006En-AJAXITI006En-AJAX
ITI006En-AJAX
 
Spring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
Spring I/O 2012: Natural Templating in Spring MVC with ThymeleafSpring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
Spring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
 
Advanced web application architecture - Talk
Advanced web application architecture - TalkAdvanced web application architecture - Talk
Advanced web application architecture - Talk
 
Jquery Ajax
Jquery AjaxJquery Ajax
Jquery Ajax
 
Ajax presentation
Ajax presentationAjax presentation
Ajax presentation
 
Jisse Reitsma 123betaal
Jisse Reitsma 123betaalJisse Reitsma 123betaal
Jisse Reitsma 123betaal
 
Introduction to AJAX
Introduction to AJAXIntroduction to AJAX
Introduction to AJAX
 
Wicket Live on Stage
Wicket Live on StageWicket Live on Stage
Wicket Live on Stage
 
Computers & Technology :: Extracting Data from an AJAX-enabled Web Site
Computers & Technology :: Extracting Data from an AJAX-enabled Web SiteComputers & Technology :: Extracting Data from an AJAX-enabled Web Site
Computers & Technology :: Extracting Data from an AJAX-enabled Web Site
 
Shootout! template engines on the jvm
Shootout! template engines on the jvmShootout! template engines on the jvm
Shootout! template engines on the jvm
 
Ajax Presentation
Ajax PresentationAjax Presentation
Ajax Presentation
 
HyperBatch
HyperBatchHyperBatch
HyperBatch
 
Web without framework
Web without frameworkWeb without framework
Web without framework
 
GraphQL-PHP: Dos and don'ts
GraphQL-PHP: Dos and don'tsGraphQL-PHP: Dos and don'ts
GraphQL-PHP: Dos and don'ts
 

Viewers also liked

4005-713 ` XML Architecture, Tools & Technique ` Presentation
4005-713 ` XML Architecture, Tools & Technique ` Presentation4005-713 ` XML Architecture, Tools & Technique ` Presentation
4005-713 ` XML Architecture, Tools & Technique ` Presentationlitcigar
 
Cloud computing by Luqman
Cloud computing by LuqmanCloud computing by Luqman
Cloud computing by LuqmanLuqman Shareef
 
Ajax tutorial by bally chohan
Ajax tutorial by bally chohanAjax tutorial by bally chohan
Ajax tutorial by bally chohanWebVineet
 
Introduction to Ajax programming
Introduction to Ajax programmingIntroduction to Ajax programming
Introduction to Ajax programmingFulvio Corno
 
Service Oriented Architecture
Service Oriented ArchitectureService Oriented Architecture
Service Oriented ArchitectureLuqman Shareef
 
Service Oriented Architecture Luqman
Service Oriented Architecture LuqmanService Oriented Architecture Luqman
Service Oriented Architecture LuqmanLuqman Shareef
 
Lotusphere 2007 AD401 LEVERAGING AJAX FRAMEWORKS TO BUILD IBM LOTUS DOMINO WE...
Lotusphere 2007 AD401 LEVERAGING AJAX FRAMEWORKS TO BUILD IBM LOTUS DOMINO WE...Lotusphere 2007 AD401 LEVERAGING AJAX FRAMEWORKS TO BUILD IBM LOTUS DOMINO WE...
Lotusphere 2007 AD401 LEVERAGING AJAX FRAMEWORKS TO BUILD IBM LOTUS DOMINO WE...dominion
 

Viewers also liked (17)

Ajax
Ajax Ajax
Ajax
 
4005-713 ` XML Architecture, Tools & Technique ` Presentation
4005-713 ` XML Architecture, Tools & Technique ` Presentation4005-713 ` XML Architecture, Tools & Technique ` Presentation
4005-713 ` XML Architecture, Tools & Technique ` Presentation
 
Tech Days 2010
Tech  Days 2010Tech  Days 2010
Tech Days 2010
 
Cloud computing by Luqman
Cloud computing by LuqmanCloud computing by Luqman
Cloud computing by Luqman
 
Ajax tutorial by bally chohan
Ajax tutorial by bally chohanAjax tutorial by bally chohan
Ajax tutorial by bally chohan
 
M Ramya
M RamyaM Ramya
M Ramya
 
J2SE 5
J2SE 5J2SE 5
J2SE 5
 
Ajax
AjaxAjax
Ajax
 
Scrum luqman
Scrum luqmanScrum luqman
Scrum luqman
 
Introduction to Ajax programming
Introduction to Ajax programmingIntroduction to Ajax programming
Introduction to Ajax programming
 
01 Ajax Intro
01 Ajax Intro01 Ajax Intro
01 Ajax Intro
 
Xml by Luqman
Xml by LuqmanXml by Luqman
Xml by Luqman
 
Restful webservices
Restful webservicesRestful webservices
Restful webservices
 
Web Service Security
Web Service SecurityWeb Service Security
Web Service Security
 
Service Oriented Architecture
Service Oriented ArchitectureService Oriented Architecture
Service Oriented Architecture
 
Service Oriented Architecture Luqman
Service Oriented Architecture LuqmanService Oriented Architecture Luqman
Service Oriented Architecture Luqman
 
Lotusphere 2007 AD401 LEVERAGING AJAX FRAMEWORKS TO BUILD IBM LOTUS DOMINO WE...
Lotusphere 2007 AD401 LEVERAGING AJAX FRAMEWORKS TO BUILD IBM LOTUS DOMINO WE...Lotusphere 2007 AD401 LEVERAGING AJAX FRAMEWORKS TO BUILD IBM LOTUS DOMINO WE...
Lotusphere 2007 AD401 LEVERAGING AJAX FRAMEWORKS TO BUILD IBM LOTUS DOMINO WE...
 

Similar to Ajax (20)

Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
Ajax Tuturial
Ajax TuturialAjax Tuturial
Ajax Tuturial
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
Xml http request
Xml http requestXml http request
Xml http request
 
AJAX.pptx
AJAX.pptxAJAX.pptx
AJAX.pptx
 
PHP - Introduction to PHP AJAX
PHP -  Introduction to PHP AJAXPHP -  Introduction to PHP AJAX
PHP - Introduction to PHP AJAX
 
Ajax
AjaxAjax
Ajax
 
Ajax Introduction
Ajax IntroductionAjax Introduction
Ajax Introduction
 
Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajax
 
Ajax
AjaxAjax
Ajax
 
Ajax workshop
Ajax workshopAjax workshop
Ajax workshop
 
Ajax Fundamentals Web Applications
Ajax Fundamentals Web ApplicationsAjax Fundamentals Web Applications
Ajax Fundamentals Web Applications
 
Ajax basics
Ajax basicsAjax basics
Ajax basics
 
Ajax
AjaxAjax
Ajax
 
AJAX Transport Layer
AJAX Transport LayerAJAX Transport Layer
AJAX Transport Layer
 
Core Java tutorial at Unit Nexus
Core Java tutorial at Unit NexusCore Java tutorial at Unit Nexus
Core Java tutorial at Unit Nexus
 

More from Venkat Krishnan

More from Venkat Krishnan (7)

Day1_23Aug.txt - Notepad
Day1_23Aug.txt - NotepadDay1_23Aug.txt - Notepad
Day1_23Aug.txt - Notepad
 
Hadoop_RealTime_Processing_eVenkat
Hadoop_RealTime_Processing_eVenkatHadoop_RealTime_Processing_eVenkat
Hadoop_RealTime_Processing_eVenkat
 
Hadoop_Admin_eVenkat
Hadoop_Admin_eVenkatHadoop_Admin_eVenkat
Hadoop_Admin_eVenkat
 
Hadoop_Architect__eVenkat
Hadoop_Architect__eVenkatHadoop_Architect__eVenkat
Hadoop_Architect__eVenkat
 
Css
CssCss
Css
 
Xml
XmlXml
Xml
 
Html
HtmlHtml
Html
 

Ajax

  • 1. Ajax! Presented Venkat Krishnan
  • 2. What is Ajax • standards-based presentation using XHTML and CSS • dynamic display and interaction using the Document Object Model • data interchange and manipulation using XML and XSLT • asynchronous data retrieval using XMLHttpRequest • and JavaScript binding everything together 2
  • 5. 5
  • 6. Examples of AJAX • GMail • Google Maps • Google Suggest • Flickr 6
  • 7. Is it new? • Not Really • Hidden Frames - IE5+, Mozilla 1.0+, Opera 7.6+ • Java - Applets 7
  • 8. Why is it popular? • Google helped popularize, and legitimize it in GMail • Increase Usability of Web Applications • Rich Internet Applications without Flash • Save Bandwidth • Download only data you need • Faster interfaces (sometimes) 8
  • 9. Why is it bad? • Breaks back button support • URL's don't change as state changes • Cross Browser Issues can be a pain • JavaScript may tax older machines CPU • Can't access domains other than the calling domain • May be disabled (for security reasons) or not available on some browsers • Debugging is difficult 9
  • 10. XMLHttpRequest • A JavaScript Class that lets you make asynchronous HTTP requests from JavaScript • Make an HTTP request from a JavaScript event • A call back JavaScript function is invoked at each state of the HTTP request and response 10
  • 11. XMLHttpRequest Properties • onreadystatechange - call back function for state changes • readyState - the current state of the HTTP call • responseText - the text result of the request • responseXML - DOM xml object from the request • status - HTTP status code of the response • statusText - HTTP status text 11
  • 12. XMLHttpRequest Example if (window.XMLHttpRequest) { var req = new XMLHttpRequest(); req.onreadystatechange = requestStateHandler; req.open("GET", "/somefile.xml", true); req.send(""); } function requestStateHandler() { if (req.readyState == 4) { //response ready alert(req.statusText); } } 12
  • 13. IE does it differently • The above example however won't work on IE req = new ActiveXOjbect("Microsoft.XMLHTTP"); • You can't totally blame them because they invented it • Native XMLHttpRequest support should be in IE7 13
  • 14. Cross Browser AJAX var req; function loadXMLDoc(url) { req = false; // branch for native XMLHttpRequest object if(window.XMLHttpRequest) { try { req = new XMLHttpRequest(); } catch(e) { req = false; } // branch for IE/Windows ActiveX version } else if(window.ActiveXObject) { try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { req = false; } } } if(req) { req.onreadystatechange = processReqChange; req.open("GET", url, true); req.send(""); } } 14
  • 15. Flash vs AJAX • No plugin for AJAX • Flash development tools cost money • Flash typically has slower page load time • Flash can work on older browsers • ActionScript doesn't have a cross browser issues • Flash can access other domains if there is a crossdomain.xml file 15