SlideShare a Scribd company logo
Web Application Development with AJAX
Huibert Aalbers
Senior Certified 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 first 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.flickr.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 benefit from the technology
Gracias
For more information, please contact me at
huibert_aalbers@mac.com

More Related Content

What's hot

Ajax
Ajax Ajax
Ajax technology
Ajax technologyAjax technology
Ajax technology
Safal Agrawal
 
Ajax basics
Ajax basicsAjax basics
Ajax basics
Vel004
 
Using Ajax In Domino Web Applications
Using Ajax In Domino Web ApplicationsUsing Ajax In Domino Web Applications
Using Ajax In Domino Web Applications
dominion
 
Ajax workshop
Ajax workshopAjax workshop
Ajax workshop
WBUTTUTORIALS
 
Ajax Ppt 1
Ajax Ppt 1Ajax Ppt 1
Ajax Ppt 1
JayaPrakash.m
 
Ajax PPT
Ajax PPTAjax PPT
Ajax PPT
Hub4Tech.com
 
Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajax
Nir Elbaz
 
Ajax
AjaxAjax
Ajax and PHP
Ajax and PHPAjax and PHP
Ajax and PHP
John Coggeshall
 
Ajax presentation
Ajax presentationAjax presentation
Ajax presentation
engcs2008
 
Architecture in Ajax Applications
Architecture in Ajax ApplicationsArchitecture in Ajax Applications
Architecture in Ajax Applications
Alois Reitbauer
 
Ajax
AjaxAjax
Ajax
AjaxAjax
PHP - Introduction to PHP AJAX
PHP -  Introduction to PHP AJAXPHP -  Introduction to PHP AJAX
PHP - Introduction to PHP AJAX
Vibrant Technologies & Computers
 
Ajax
AjaxAjax
Advantages and disadvantages of an ajax based client application
Advantages and disadvantages of an ajax based client applicationAdvantages and disadvantages of an ajax based client application
Advantages and disadvantages of an ajax based client application
Placinta Alin
 
Asynchronous JavaScript & XML (AJAX)
Asynchronous JavaScript & XML (AJAX)Asynchronous JavaScript & XML (AJAX)
Asynchronous JavaScript & XML (AJAX)
Adnan Sohail
 
AJAX
AJAXAJAX
Ajax ppt - 32 slides
Ajax ppt - 32 slidesAjax ppt - 32 slides
Ajax ppt - 32 slides
Smithss25
 

What's hot (20)

Ajax
Ajax Ajax
Ajax
 
Ajax technology
Ajax technologyAjax technology
Ajax technology
 
Ajax basics
Ajax basicsAjax basics
Ajax basics
 
Using Ajax In Domino Web Applications
Using Ajax In Domino Web ApplicationsUsing Ajax In Domino Web Applications
Using Ajax In Domino Web Applications
 
Ajax workshop
Ajax workshopAjax workshop
Ajax workshop
 
Ajax Ppt 1
Ajax Ppt 1Ajax Ppt 1
Ajax Ppt 1
 
Ajax PPT
Ajax PPTAjax PPT
Ajax PPT
 
Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajax
 
Ajax
AjaxAjax
Ajax
 
Ajax and PHP
Ajax and PHPAjax and PHP
Ajax and PHP
 
Ajax presentation
Ajax presentationAjax presentation
Ajax presentation
 
Architecture in Ajax Applications
Architecture in Ajax ApplicationsArchitecture in Ajax Applications
Architecture in Ajax Applications
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
PHP - Introduction to PHP AJAX
PHP -  Introduction to PHP AJAXPHP -  Introduction to PHP AJAX
PHP - Introduction to PHP AJAX
 
Ajax
AjaxAjax
Ajax
 
Advantages and disadvantages of an ajax based client application
Advantages and disadvantages of an ajax based client applicationAdvantages and disadvantages of an ajax based client application
Advantages and disadvantages of an ajax based client application
 
Asynchronous JavaScript & XML (AJAX)
Asynchronous JavaScript & XML (AJAX)Asynchronous JavaScript & XML (AJAX)
Asynchronous JavaScript & XML (AJAX)
 
AJAX
AJAXAJAX
AJAX
 
Ajax ppt - 32 slides
Ajax ppt - 32 slidesAjax ppt - 32 slides
Ajax ppt - 32 slides
 

Similar to ITI006En-AJAX

Ajax tutorial by bally chohan
Ajax tutorial by bally chohanAjax tutorial by bally chohan
Ajax tutorial by bally chohan
WebVineet
 
Ajax
AjaxAjax
Ajax
AjaxAjax
AJAX.pptx
AJAX.pptxAJAX.pptx
AJAX.pptx
Ganesh Chavan
 
AJAX
AJAXAJAX
M Ramya
M RamyaM Ramya
Ajax
AjaxAjax
Ajax
AjaxAjax
Ajax Technology
Ajax TechnologyAjax Technology
Ajax Technology
Zia_Rehman
 
Ajax Tuturial
Ajax TuturialAjax Tuturial
Ajax Tuturial
Anup Singh
 
25250716 seminar-on-ajax text
25250716 seminar-on-ajax text25250716 seminar-on-ajax text
25250716 seminar-on-ajax text
Kamleshh Chandnani
 
Ajax
AjaxAjax
Ajax
AjaxAjax
Ajax
AjaxAjax
Ajax Overview by Bally Chohan
Ajax Overview by Bally ChohanAjax Overview by Bally Chohan
Ajax Overview by Bally Chohan
WebVineet
 
Ajax
AjaxAjax
AJAX
AJAXAJAX
AJAX
ARJUN
 
Ajax
AjaxAjax
Learn AJAX at ASIT
Learn AJAX at ASITLearn AJAX at ASIT
Learn AJAX at ASIT
ASIT
 
Ajax
AjaxAjax

Similar to ITI006En-AJAX (20)

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.pptx
AJAX.pptxAJAX.pptx
AJAX.pptx
 
AJAX
AJAXAJAX
AJAX
 
M Ramya
M RamyaM Ramya
M Ramya
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
Ajax Technology
Ajax TechnologyAjax Technology
Ajax Technology
 
Ajax Tuturial
Ajax TuturialAjax Tuturial
Ajax Tuturial
 
25250716 seminar-on-ajax text
25250716 seminar-on-ajax text25250716 seminar-on-ajax text
25250716 seminar-on-ajax text
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
Ajax Overview by Bally Chohan
Ajax Overview by Bally ChohanAjax Overview by Bally Chohan
Ajax Overview by Bally Chohan
 
Ajax
AjaxAjax
Ajax
 
AJAX
AJAXAJAX
AJAX
 
Ajax
AjaxAjax
Ajax
 
Learn AJAX at ASIT
Learn AJAX at ASITLearn AJAX at ASIT
Learn AJAX at ASIT
 
Ajax
AjaxAjax
Ajax
 

Recently uploaded

Voxxed Days Trieste 2024 - Unleashing the Power of Vector Search and Semantic...
Voxxed Days Trieste 2024 - Unleashing the Power of Vector Search and Semantic...Voxxed Days Trieste 2024 - Unleashing the Power of Vector Search and Semantic...
Voxxed Days Trieste 2024 - Unleashing the Power of Vector Search and Semantic...
Luigi Fugaro
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
safelyiotech
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
ToXSL Technologies
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
dakas1
 
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
widenerjobeyrl638
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 
ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.
Maitrey Patel
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
Bert Jan Schrijver
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
The Third Creative Media
 
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
OnePlan Solutions
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
ShulagnaSarkar2
 
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
campbellclarkson
 
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom KittEnhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Peter Caitens
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and MoreManyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
narinav14
 
Superpower Your Apache Kafka Applications Development with Complementary Open...
Superpower Your Apache Kafka Applications Development with Complementary Open...Superpower Your Apache Kafka Applications Development with Complementary Open...
Superpower Your Apache Kafka Applications Development with Complementary Open...
Paul Brebner
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
kalichargn70th171
 
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptxOperational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
sandeepmenon62
 

Recently uploaded (20)

Voxxed Days Trieste 2024 - Unleashing the Power of Vector Search and Semantic...
Voxxed Days Trieste 2024 - Unleashing the Power of Vector Search and Semantic...Voxxed Days Trieste 2024 - Unleashing the Power of Vector Search and Semantic...
Voxxed Days Trieste 2024 - Unleashing the Power of Vector Search and Semantic...
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
 
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
 
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
 
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
 
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom KittEnhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and MoreManyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
 
Superpower Your Apache Kafka Applications Development with Complementary Open...
Superpower Your Apache Kafka Applications Development with Complementary Open...Superpower Your Apache Kafka Applications Development with Complementary Open...
Superpower Your Apache Kafka Applications Development with Complementary Open...
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
 
bgiolcb
bgiolcbbgiolcb
bgiolcb
 
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptxOperational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
 

ITI006En-AJAX

  • 1. Web Application Development with AJAX Huibert Aalbers Senior Certified 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 first 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.flickr.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 benefit from the technology
  • 13. Gracias For more information, please contact me at huibert_aalbers@mac.com