SlideShare a Scribd company logo
 
Introduction Traditional Web Application Model AJAX Web Application Model Is It New ? Flash vs. AJAX XML Http Objects Pros Cons
Asynchronous JavaScript And XML Ajax is combination of following web technologies HTML and CSS JavaScript and the DOM XML and the XMLHttpRequest object Became popular with Google applications
 
 
Not Really  Hidden Frames IE5+, Mozilla 1.0+, Safari 1.2+, and Opera 7.6+ Some Code <frameset rows=&quot;100%,0&quot; frameborder=&quot;0&quot;>  <frame name=&quot; displayFrame&quot; src=&quot; display.htm&quot; noresize=&quot; noresize&quot; />  <frame name=&quot; hiddenFrame&quot; src=&quot; about:blank&quot; noresize=&quot; noresize&quot; /> </frameset>
<p>Enter customer ID number to retrieve information:</p> <p>Customer ID: <input type=&quot; text&quot; id=&quot; txtCustomerId&quot; value=&quot;&quot; /></p> <p><input type=&quot; button&quot; value=&quot; Get Customer Info&quot;  onclick=&quot; requestCustomerInfo()&quot; /></p> <div id=&quot; divCustomerInfo&quot;></div>
function requestCustomerInfo()  {  var sId = document.getElementById(&quot;txtCustomerId&quot;).value;  top.frames[&quot;hiddenFrame&quot;].location = &quot;getcustomerdata.aspx?id=&quot; + sId; }
function displayCustomerInfo(sText)  {  var divCustomerInfo = document.getElementById(&quot;divCustomerInfo&quot;);  divCustomerInfo.innerHTML = sText; }
<html>  <head>  <title>Get Customer Data</title> <%  //asp.net code  %>  </head>  <body>  <div id=&quot; divInfoToReturn&quot;> <% Response.write(sInfo); ?> </div>  </body> </html>
window.onload = function ()  {  var divInfoToReturn = document.getElementById(&quot;divInfoToReturn&quot;);  top.frames[&quot;displayFrame&quot;].displayCustomerInfo(divInfoToReturn.innerHTML); };
Pros Maintains Browser History Cons If the hidden frame page failed to load, there is no notification to the user that a problem has occurred; the main page will continue to wait until the appropriate JavaScript function is called
No plug-in 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
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
XMLHttpRequest Properties onreadystatechange  - call back function for state changes Ready State  - the current state of the HTTP call Response Text  - the text result of the request Response XML  - DOM xml object from the request Status  - HTTP status code of the response Status Text  - HTTP status text
function createXMLHttp()  { if (typeof XMLHttpRequest != &quot;undefined&quot;)  { return new XMLHttpRequest(); } else if (window.ActiveXObject) { var aVersions = [ &quot;MSXML2.XMLHttp.5.0&quot;, &quot;MSXML2.XMLHttp.4.0&quot;,&quot;MSXML2.XMLHttp.3.0&quot;, &quot;MSXML2.XMLHttp&quot;,&quot;Microsoft.XMLHttp&quot;];   for (var i = 0; i < aVersions.length; i++) { try { var oXmlHttp = new ActiveXObject(aVersions[i]); return oXmlHttp; } catch (oError) { } } throw new Error(&quot;MSXML is not installed.&quot;); } }
function disable() { var btnSignUp = document.getElementById(&quot;Button1&quot;); btnSignUp.disabled = true; }
function validateField(txtField)  { var url= &quot;working.aspx&quot;; url=url+&quot;?username=&quot; url=url+ txtField.value; var oXmlHttp = createXMLHttp(); oXmlHttp.open(&quot;get&quot;, url, true);
oXmlHttp.onreadystatechange = function () { if (oXmlHttp.readyState == 4) { if (oXmlHttp.status == 200) { var arrInfo = oXmlHttp.responseText.split(&quot;||&quot;); var Error = document.getElementById(txtField.id + &quot;err&quot;); var btnSignUp = document.getElementById(&quot;Button1&quot;);   if (!eval(arrInfo[0])) { Error.innerHTML = &quot;User Alredy Exists&quot;; Error.style.display = &quot;block&quot;; txtField.valid = false; btnSignUp.disabled = true; } else { Error.style.display = &quot;none&quot;;   //imgError.style.display = &quot;none&quot;; txtField.valid = true; btnSignUp.disabled = false; }
//document.getElementById(&quot;Button1&quot;).Enable=false; } else { alert(&quot;An error occurred while trying to contact the server.&quot;); } } }; oXmlHttp.send(null); }
Google helped popularize and legitimize by implementing it in GMail Increase Usability of Web Applications Rich Internet Applications without Flash Save Bandwidth Download only data you need Faster interfaces (sometimes)
Breaks back button support URL's not 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
 

More Related Content

PPT
Introduction to javaScript
PPT
PDF
Ajax
PPT
Ajax
PPTX
Javascript
PDF
Introduction to thymeleaf
PDF
Broadleaf Presents Thymeleaf
PPT
symfony & jQuery (phpDay)
Introduction to javaScript
Ajax
Ajax
Javascript
Introduction to thymeleaf
Broadleaf Presents Thymeleaf
symfony & jQuery (phpDay)

What's hot (19)

PDF
Introducing thymeleaf
PDF
Thymeleaf Introduction
PDF
Desafios do Profissionalismo Ágil
PPT
シックス・アパート・フレームワーク
PPT
JavaScript & Dom Manipulation
PPT
Java script
PPT
JavaScript
PDF
Automated testing for client-side - Adam Klein, 500 Tech
ODP
Scti 2011 minicurso jquery
PPT
Java script programs
PPTX
Schematron and Other Useful Tools
PPT
Developing PHP Web Applications with the Raxan Framework
PPTX
Mule esb first http connector
PPTX
JavaScript Training in Ambala ! Batra Computer Centre
PDF
Js c1 best practices
PDF
2013-06-25 - HTML5 & JavaScript Security
PPT
Perlbal Tutorial
PDF
JAVA SCRIPT
PDF
Human Talks - StencilJS
Introducing thymeleaf
Thymeleaf Introduction
Desafios do Profissionalismo Ágil
シックス・アパート・フレームワーク
JavaScript & Dom Manipulation
Java script
JavaScript
Automated testing for client-side - Adam Klein, 500 Tech
Scti 2011 minicurso jquery
Java script programs
Schematron and Other Useful Tools
Developing PHP Web Applications with the Raxan Framework
Mule esb first http connector
JavaScript Training in Ambala ! Batra Computer Centre
Js c1 best practices
2013-06-25 - HTML5 & JavaScript Security
Perlbal Tutorial
JAVA SCRIPT
Human Talks - StencilJS
Ad

Viewers also liked (7)

ODP
jQuery : Talk to server with Ajax
PDF
OpenThink Labs : Dengar Pendapat Komunitas ciliwung dengan kemen pu dan kemen...
PDF
PostgreSQL BootCamp : Manajemen Master Data dengan SkyTools
PDF
OpenThink Labs Workshop : Ketahanan Pangan Skala RT/RW
PDF
Pengembangan OpenThink SAS 2013-2014
PDF
Ketahanan Pangan #1 : Gerakan Sekolah Menanam Melon
PDF
ICA – AtoM : Retensi Arsip
jQuery : Talk to server with Ajax
OpenThink Labs : Dengar Pendapat Komunitas ciliwung dengan kemen pu dan kemen...
PostgreSQL BootCamp : Manajemen Master Data dengan SkyTools
OpenThink Labs Workshop : Ketahanan Pangan Skala RT/RW
Pengembangan OpenThink SAS 2013-2014
Ketahanan Pangan #1 : Gerakan Sekolah Menanam Melon
ICA – AtoM : Retensi Arsip
Ad

Similar to Ajax (20)

PPT
Ajax ppt
PPT
Ajax Ppt
PPT
AJAX Workshop Notes
PPT
PPT
Ajax Fundamentals Web Applications
PPT
Ajaxppt
PPT
Javascript: Ajax & DOM Manipulation v1.2
PDF
Core Java tutorial at Unit Nexus
PPTX
Introduction to AJAX and DWR
PPT
Xml http request
PPT
Implementing Ajax In ColdFusion 7
PDF
How to make Ajax work for you
PPT
PPT
Ajax
PPT
Ajax presentation
PPT
Ajax Introduction
PDF
AJAX Transport Layer
PPT
mukesh
Ajax ppt
Ajax Ppt
AJAX Workshop Notes
Ajax Fundamentals Web Applications
Ajaxppt
Javascript: Ajax & DOM Manipulation v1.2
Core Java tutorial at Unit Nexus
Introduction to AJAX and DWR
Xml http request
Implementing Ajax In ColdFusion 7
How to make Ajax work for you
Ajax
Ajax presentation
Ajax Introduction
AJAX Transport Layer
mukesh

Recently uploaded (20)

PPTX
Chapter 5: Probability Theory and Statistics
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
1 - Historical Antecedents, Social Consideration.pdf
PPTX
Tartificialntelligence_presentation.pptx
PDF
project resource management chapter-09.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Hybrid model detection and classification of lung cancer
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Mushroom cultivation and it's methods.pdf
PPTX
A Presentation on Touch Screen Technology
Chapter 5: Probability Theory and Statistics
Programs and apps: productivity, graphics, security and other tools
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Encapsulation_ Review paper, used for researhc scholars
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Unlocking AI with Model Context Protocol (MCP)
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
DP Operators-handbook-extract for the Mautical Institute
Assigned Numbers - 2025 - Bluetooth® Document
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
1 - Historical Antecedents, Social Consideration.pdf
Tartificialntelligence_presentation.pptx
project resource management chapter-09.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
TLE Review Electricity (Electricity).pptx
Hybrid model detection and classification of lung cancer
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Mushroom cultivation and it's methods.pdf
A Presentation on Touch Screen Technology

Ajax

  • 1.  
  • 2. Introduction Traditional Web Application Model AJAX Web Application Model Is It New ? Flash vs. AJAX XML Http Objects Pros Cons
  • 3. Asynchronous JavaScript And XML Ajax is combination of following web technologies HTML and CSS JavaScript and the DOM XML and the XMLHttpRequest object Became popular with Google applications
  • 4.  
  • 5.  
  • 6. Not Really Hidden Frames IE5+, Mozilla 1.0+, Safari 1.2+, and Opera 7.6+ Some Code <frameset rows=&quot;100%,0&quot; frameborder=&quot;0&quot;> <frame name=&quot; displayFrame&quot; src=&quot; display.htm&quot; noresize=&quot; noresize&quot; /> <frame name=&quot; hiddenFrame&quot; src=&quot; about:blank&quot; noresize=&quot; noresize&quot; /> </frameset>
  • 7. <p>Enter customer ID number to retrieve information:</p> <p>Customer ID: <input type=&quot; text&quot; id=&quot; txtCustomerId&quot; value=&quot;&quot; /></p> <p><input type=&quot; button&quot; value=&quot; Get Customer Info&quot; onclick=&quot; requestCustomerInfo()&quot; /></p> <div id=&quot; divCustomerInfo&quot;></div>
  • 8. function requestCustomerInfo() { var sId = document.getElementById(&quot;txtCustomerId&quot;).value; top.frames[&quot;hiddenFrame&quot;].location = &quot;getcustomerdata.aspx?id=&quot; + sId; }
  • 9. function displayCustomerInfo(sText) { var divCustomerInfo = document.getElementById(&quot;divCustomerInfo&quot;); divCustomerInfo.innerHTML = sText; }
  • 10. <html> <head> <title>Get Customer Data</title> <% //asp.net code  %> </head> <body> <div id=&quot; divInfoToReturn&quot;> <% Response.write(sInfo); ?> </div> </body> </html>
  • 11. window.onload = function () { var divInfoToReturn = document.getElementById(&quot;divInfoToReturn&quot;); top.frames[&quot;displayFrame&quot;].displayCustomerInfo(divInfoToReturn.innerHTML); };
  • 12. Pros Maintains Browser History Cons If the hidden frame page failed to load, there is no notification to the user that a problem has occurred; the main page will continue to wait until the appropriate JavaScript function is called
  • 13. No plug-in 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
  • 14. 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
  • 15. XMLHttpRequest Properties onreadystatechange - call back function for state changes Ready State - the current state of the HTTP call Response Text - the text result of the request Response XML - DOM xml object from the request Status - HTTP status code of the response Status Text - HTTP status text
  • 16. function createXMLHttp() { if (typeof XMLHttpRequest != &quot;undefined&quot;) { return new XMLHttpRequest(); } else if (window.ActiveXObject) { var aVersions = [ &quot;MSXML2.XMLHttp.5.0&quot;, &quot;MSXML2.XMLHttp.4.0&quot;,&quot;MSXML2.XMLHttp.3.0&quot;, &quot;MSXML2.XMLHttp&quot;,&quot;Microsoft.XMLHttp&quot;];   for (var i = 0; i < aVersions.length; i++) { try { var oXmlHttp = new ActiveXObject(aVersions[i]); return oXmlHttp; } catch (oError) { } } throw new Error(&quot;MSXML is not installed.&quot;); } }
  • 17. function disable() { var btnSignUp = document.getElementById(&quot;Button1&quot;); btnSignUp.disabled = true; }
  • 18. function validateField(txtField) { var url= &quot;working.aspx&quot;; url=url+&quot;?username=&quot; url=url+ txtField.value; var oXmlHttp = createXMLHttp(); oXmlHttp.open(&quot;get&quot;, url, true);
  • 19. oXmlHttp.onreadystatechange = function () { if (oXmlHttp.readyState == 4) { if (oXmlHttp.status == 200) { var arrInfo = oXmlHttp.responseText.split(&quot;||&quot;); var Error = document.getElementById(txtField.id + &quot;err&quot;); var btnSignUp = document.getElementById(&quot;Button1&quot;);   if (!eval(arrInfo[0])) { Error.innerHTML = &quot;User Alredy Exists&quot;; Error.style.display = &quot;block&quot;; txtField.valid = false; btnSignUp.disabled = true; } else { Error.style.display = &quot;none&quot;; //imgError.style.display = &quot;none&quot;; txtField.valid = true; btnSignUp.disabled = false; }
  • 20. //document.getElementById(&quot;Button1&quot;).Enable=false; } else { alert(&quot;An error occurred while trying to contact the server.&quot;); } } }; oXmlHttp.send(null); }
  • 21. Google helped popularize and legitimize by implementing it in GMail Increase Usability of Web Applications Rich Internet Applications without Flash Save Bandwidth Download only data you need Faster interfaces (sometimes)
  • 22. Breaks back button support URL's not 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
  • 23.