SlideShare a Scribd company logo
Web Application Development with AJAX
Huibert Aalbers
Senior CertiïŹed Software IT Architect
IT Insight podcast
‱ This podcast belongs to the IT Insight series‹
You can subscribe to the podcast through iTunes.
‱ Additional material such as presentations in PDF format or white
papers mentioned in the podcast can be downloaded from the IT
insight section of my site at http://www.huibert-aalbers.com
‱ You can send questions or suggestions regarding this podcast to my
personal email, huibert_aalbers@mac.com
¿Qué es AJAX?
‱ AJAX stands for
‱ Asynchronous Javascript‹
And‹
XML
‱ This term was coined by a company called Adaptive Path to refer to Web 2.0
applications that offer richer and better user interfaces
‱ Microsoft developed the ïŹrst AJAX application, Outlook Web Access using
proprietary HTML extensions
What problem does AJAX solve?
‱ Before AJAX, each time a web application interacted with a server, the
complete page had to be reloaded
‱ Using AJAX technologies this is no longer true. Instead, a JavaScript routine
connects to the server through an XMLHttpRequest and the result is
displayed using dynamic HTML to update the page
‱ The result is faster web apps that look more like traditional C/S applications
Who uses AJAX?
‱ AJAX has gained a lot of popularity since Google started using it in their
extremely successful web applications
‱ GMail, Google Maps, Google suggest, Google calendar
‱ Other companies are also adopting AJAX
‱ http://www.ïŹ‚ickr.com
‱ http://www.kiko.com
‱ http://www.protopage.com
‱ http://www.writely.com
Which browsers support AJAX?
‱ In order to support AJAX, a browser has to support the latest W3C standards
such as CSS 2 and 3, Javascript and the XMLHttpRequest object or
equivalent
‱ Safari 1.2 and later or Konkeror (browsers based on kHTML) Internet
Explorer 4.0 and later (Microsoft)
‱ Firefox 1.0, Mozilla 1.0, Netscape 7.0, Camino 1.0 (browsers based on the
browser engine from the Mozilla Foundation)
‱ Opera 7.6 and later
Problems faced by AJAX applications
‱ The back button may not work as expected, and something similar applies to
bookmarking
‱ Search engines cannot easily index pages that include AJAX code
‱ The Javascript code has to be able to handle communications problems with
the back-end server transparently for the user and this requires a lot of code
since Javascript was not really designed to handle complex tasks
‱ The MVC paradigm tried to separate the application code from the
presentation layer. AJAX makes this impossible, once again
The XMLHttpRequest object
‱ In order to communicate with a server, the Javascript code needs to use an
XMLHttpRequest object
‱ Despite its name, this object does not require to use data written in XML
format, any type of data can be used
‱ Internet Explorer does not support the XMLHttpRequest object but supports
similar functionality through ActiveX objects
‱ The XMLHttpRequest object offers different methods that can be used to
interact asynchronously with a back-end server.This allows the application
to process multiple connections in parallel without blocking the browser until
a response is received
Creating an XMLHttpRequest object and
invoking a URL on a back-end server
var req;
function loadXMLDoc(url)
{
if (window.XMLHttpRequest)
{
// The browser supports the XMLHttpRequest object
req = new XMLHttpRequest();
req.onreadystatechange = processReqChange;
req.open("GET", url, true);
req.send(null);
}
else if (window.ActiveXObject)
{
// This code is required to support IE
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.onreadystatechange = processReqChange;
req.open("GET", url, true);
req.send();
}
}
}
Asynchronously processing the response
from the back-end server
function processReqChange()
{
// Request completed
if (req.readyState == 4)
// Result is "OK"
if (req.status == 200) {
// This code handles the response...
// ...and updates the page accordingly...
}
else {
alert(“There was a problem:n"
+ req.statusText);
}
}
}
How to write de the back-end server code?
‱ AJAX applications do not care about the language used to write the back-end application.
‱ All that is needed is that the reply has a Content-Type of text/xml if the response is an XML
document or text/plain or text/html otherwise
‱ This means that the back-end server code can be written in almost any language
‱ C/C++ CGIs
‱ Java Servlet, Java Server Page
‱ PHP
‱ ASP,etc
Final thoughts
‱ AJAX is not only about the XMLHTTPRequest object. In order to write a
successful AJAX application it is necessary to have a very thorough
understanding of other W3C standards such as DOM and CSS
‱ Since AJAX is based on cutting edge browser technologies, differences
between the three major browsers (IE, Mozilla and Safari) must be understood
and properly handled
‱ Because of the previous points, writing AJAX applications is still quite
complex.That is why, no one uses AJAX for a whole site, instead its use is
limited to certain applications that can beneïŹt from the technology
Gracias
For more information, please contact me at
huibert_aalbers@mac.com

More Related Content

PDF
PPT
Ajax
PPTX
Introduction to ajax
PPTX
Overview of AJAX
PPSX
Ajax part i
PPT
Introduction to ajax
Ajax
Introduction to ajax
Overview of AJAX
Ajax part i
Introduction to ajax

What's hot (20)

PPTX
Ajax technology
PDF
Ajax basics
 
PPT
Using Ajax In Domino Web Applications
PPT
Ajax workshop
PPT
Ajax Ppt 1
PPTX
Ajax PPT
PDF
Introduction to ajax
PPTX
PPT
Ajax and PHP
PPT
Ajax presentation
PPTX
Architecture in Ajax Applications
PPT
PPT
PHP - Introduction to PHP AJAX
PPT
Ajax
PPT
Advantages and disadvantages of an ajax based client application
PPT
Asynchronous JavaScript & XML (AJAX)
PPT
AJAX
PPTX
Ajax ppt - 32 slides
Ajax technology
Ajax basics
 
Using Ajax In Domino Web Applications
Ajax workshop
Ajax Ppt 1
Ajax PPT
Introduction to ajax
Ajax and PHP
Ajax presentation
Architecture in Ajax Applications
PHP - Introduction to PHP AJAX
Ajax
Advantages and disadvantages of an ajax based client application
Asynchronous JavaScript & XML (AJAX)
AJAX
Ajax ppt - 32 slides
Ad

Similar to ITI006En-AJAX (20)

PPT
Ajax tutorial by bally chohan
PPT
Web Programming using Asynchronous JavaX
PPT
Ajax
PPT
PPTX
AJAX.pptx
PPT
AJAX
PPTX
Ajax
PPT
Ajax
PPTX
Ajax Technology
PPT
Ajax Tuturial
TXT
25250716 seminar-on-ajax text
PPT
Ajax
PPT
PPTX
PPT
Ajax Overview by Bally Chohan
PDF
Ajax
PPT
AJAX
 
PPT
PPTX
Learn AJAX at ASIT
 
Ajax tutorial by bally chohan
Web Programming using Asynchronous JavaX
Ajax
AJAX.pptx
AJAX
Ajax
Ajax
Ajax Technology
Ajax Tuturial
25250716 seminar-on-ajax text
Ajax
Ajax Overview by Bally Chohan
Ajax
AJAX
 
Learn AJAX at ASIT
 
Ad

Recently uploaded (20)

PPT
Introduction Database Management System for Course Database
PPTX
Introduction to Artificial Intelligence
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
 
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
medical staffing services at VALiNTRY
PPTX
Online Work Permit System for Fast Permit Processing
PDF
System and Network Administraation Chapter 3
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PPTX
L1 - Introduction to python Backend.pptx
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
ai tools demonstartion for schools and inter college
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
AI in Product Development-omnex systems
Introduction Database Management System for Course Database
Introduction to Artificial Intelligence
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
 
Internet Downloader Manager (IDM) Crack 6.42 Build 41
medical staffing services at VALiNTRY
Online Work Permit System for Fast Permit Processing
System and Network Administraation Chapter 3
VVF-Customer-Presentation2025-Ver1.9.pptx
Upgrade and Innovation Strategies for SAP ERP Customers
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
2025 Textile ERP Trends: SAP, Odoo & Oracle
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
L1 - Introduction to python Backend.pptx
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
How Creative Agencies Leverage Project Management Software.pdf
ai tools demonstartion for schools and inter college
ManageIQ - Sprint 268 Review - Slide Deck
Understanding Forklifts - TECH EHS Solution
CHAPTER 2 - PM Management and IT Context
AI in Product Development-omnex systems

ITI006En-AJAX

  • 1. Web Application Development with AJAX Huibert Aalbers Senior CertiïŹed Software IT Architect
  • 2. IT Insight podcast ‱ This podcast belongs to the IT Insight series‹ You can subscribe to the podcast through iTunes. ‱ Additional material such as presentations in PDF format or white papers mentioned in the podcast can be downloaded from the IT insight section of my site at http://www.huibert-aalbers.com ‱ You can send questions or suggestions regarding this podcast to my personal email, huibert_aalbers@mac.com
  • 3. ÂżQuĂ© es AJAX? ‱ AJAX stands for ‱ Asynchronous Javascript‹ And‹ XML ‱ This term was coined by a company called Adaptive Path to refer to Web 2.0 applications that offer richer and better user interfaces ‱ Microsoft developed the ïŹrst AJAX application, Outlook Web Access using proprietary HTML extensions
  • 4. What problem does AJAX solve? ‱ Before AJAX, each time a web application interacted with a server, the complete page had to be reloaded ‱ Using AJAX technologies this is no longer true. Instead, a JavaScript routine connects to the server through an XMLHttpRequest and the result is displayed using dynamic HTML to update the page ‱ The result is faster web apps that look more like traditional C/S applications
  • 5. Who uses AJAX? ‱ AJAX has gained a lot of popularity since Google started using it in their extremely successful web applications ‱ GMail, Google Maps, Google suggest, Google calendar ‱ Other companies are also adopting AJAX ‱ http://www.ïŹ‚ickr.com ‱ http://www.kiko.com ‱ http://www.protopage.com ‱ http://www.writely.com
  • 6. Which browsers support AJAX? ‱ In order to support AJAX, a browser has to support the latest W3C standards such as CSS 2 and 3, Javascript and the XMLHttpRequest object or equivalent ‱ Safari 1.2 and later or Konkeror (browsers based on kHTML) Internet Explorer 4.0 and later (Microsoft) ‱ Firefox 1.0, Mozilla 1.0, Netscape 7.0, Camino 1.0 (browsers based on the browser engine from the Mozilla Foundation) ‱ Opera 7.6 and later
  • 7. Problems faced by AJAX applications ‱ The back button may not work as expected, and something similar applies to bookmarking ‱ Search engines cannot easily index pages that include AJAX code ‱ The Javascript code has to be able to handle communications problems with the back-end server transparently for the user and this requires a lot of code since Javascript was not really designed to handle complex tasks ‱ The MVC paradigm tried to separate the application code from the presentation layer. AJAX makes this impossible, once again
  • 8. The XMLHttpRequest object ‱ In order to communicate with a server, the Javascript code needs to use an XMLHttpRequest object ‱ Despite its name, this object does not require to use data written in XML format, any type of data can be used ‱ Internet Explorer does not support the XMLHttpRequest object but supports similar functionality through ActiveX objects ‱ The XMLHttpRequest object offers different methods that can be used to interact asynchronously with a back-end server.This allows the application to process multiple connections in parallel without blocking the browser until a response is received
  • 9. Creating an XMLHttpRequest object and invoking a URL on a back-end server var req; function loadXMLDoc(url) { if (window.XMLHttpRequest) { // The browser supports the XMLHttpRequest object req = new XMLHttpRequest(); req.onreadystatechange = processReqChange; req.open("GET", url, true); req.send(null); } else if (window.ActiveXObject) { // This code is required to support IE req = new ActiveXObject("Microsoft.XMLHTTP"); if (req) { req.onreadystatechange = processReqChange; req.open("GET", url, true); req.send(); } } }
  • 10. Asynchronously processing the response from the back-end server function processReqChange() { // Request completed if (req.readyState == 4) // Result is "OK" if (req.status == 200) { // This code handles the response... // ...and updates the page accordingly... } else { alert(“There was a problem:n" + req.statusText); } } }
  • 11. How to write de the back-end server code? ‱ AJAX applications do not care about the language used to write the back-end application. ‱ All that is needed is that the reply has a Content-Type of text/xml if the response is an XML document or text/plain or text/html otherwise ‱ This means that the back-end server code can be written in almost any language ‱ C/C++ CGIs ‱ Java Servlet, Java Server Page ‱ PHP ‱ ASP,etc
  • 12. Final thoughts ‱ AJAX is not only about the XMLHTTPRequest object. In order to write a successful AJAX application it is necessary to have a very thorough understanding of other W3C standards such as DOM and CSS ‱ Since AJAX is based on cutting edge browser technologies, differences between the three major browsers (IE, Mozilla and Safari) must be understood and properly handled ‱ Because of the previous points, writing AJAX applications is still quite complex.That is why, no one uses AJAX for a whole site, instead its use is limited to certain applications that can beneïŹt from the technology
  • 13. Gracias For more information, please contact me at huibert_aalbers@mac.com