SlideShare a Scribd company logo
Internet Technologies
    Introduction to AJAX
         Dr. Abzetdin ADAMOV
   Chair of Computer Engineering Department
              aadamov@qu.edu.az
       http://ce.qu.edu.az/~aadamov
What is Ajax?
• "Asynchronous JavaScript and XML"
• New name for an old technique:
   –   JavaScript + DHTML + XMLHttpRequest
   –   In use since at least 1997
   –   Finally someone gave it a name
   –   Already enabled in your Web server and browser
• Use JavaScript asynchronously behind the scenes to
  load additional data (typically XML) without
  discarding and reloading the entire Web page.


                                                        2
Why use Ajax?
• Your users will soon demand it
   – Not just another cool (geeky) technology
   – Very user-visible effect
   – Rich UI experience in a Web page
• Portable across browsers
• Plus, all advantages of zero-install Web app
   – No install done for this demo
   – No "DLL Hell"




                                                 3
Why use Ajax?
• Client/Server Apps:
   – Dynamic data
   – Static forms, controls, code, etc.
   – Efficient, but not flexible
• Traditional Web Apps:
   – Dynamic data
   – Dynamic forms, controls, code, etc.
   – Flexible, but inefficient, and noticeably slow
• Ajax Apps:
   – Dynamic data
   – Static or dynamic forms, controls, code, etc.
   – Best of both worlds


                                                      4
Why use Ajax?
• Geeky reasons:
  – Multithreaded data retrieval from Web servers
     •   Pre-fetch data before needed
     •   Progress indicators
     •   Appearance of speed
     •   Avoids need for setTimeout()
  – Less bandwidth required; less server load
     • Reload partial page, not entire page
     • Load data only, not even partial page




                                                    5
How much to use Ajax?
•   As little or as much as you like
•   No need to abandon what you already do
•   One more item in your "bag of tricks"
•   Start by jazzing up your existing UI




                                             6
How to use Ajax?

    Simple!

   Use the
XMLHttpRequest
    Object



                   7
XMLHttpRequest Methods

•   open (“method”, “URL”, [async, username, password])
     – Assigns destination URL, method, etc.
•   send (params)
     – Sends request including postable string or DOM object data
•   abort ()
     – Terminates current request
•   getAllResponseHeaders ()
     – Returns headers (name/value pairs) as a string
•   getResponseHeader (“header”)
     – Returns value of a given header
•   setRequestHeader (“label”,”value”)
     – Sets Request Headers before sending


                                                                    8
XMLHttpRequest Properties
•    onreadystatechange
     – Event handler (your code) that fires at each state change
•    readyState
        0 = uninitialized       3 = interactive (some data has been returned)
        1 = loading                                (broken in IE 6.0)
        2 = loaded              4 = complete
•    status
     – HTTP Status returned from server: 200-299 = OK
•    responseText
     – String version of data returned from server
•    responseXML
     – XML DOM document of data returned
•    statusText
     – Status text returned from server

                                                                                9
Simple Example
var req = new XMLHttpRequest();
req.onreadystatechange = myHandler;
req.open("GET", "servlet", true);
req.send("p1=abc");

...

function myHandler() {
  if (req.readyState == 4) {
    doSomethingWith(req.responseXML);
  }
  else if (req.readyState == 3) {
    showProgressIndicator();
  }
}




                                        10
Demos
• http://studlinux.qafqaz.local/~s08_aaz/ajax
   –   Simple demo
   –   More demos
   –   Google Suggest
   –   Google Maps
   –   Language translation
   –   Mouse gesture as password
   –   Typing speed as password
   –   Classified ads tied to map
   –   "Mashups"


                                                11
Security Issues
• Can only hit domain the Web page came from
  – Cannot access a 3rd party Web Service
  – However:
     • You can wrap those requests through your own server
     • User can allow access to specific sites via browser security settings
     • IFRAME can access any site (instead of XMLHttpRequest)




                                                                               12
Advanced Topics
– XSLT and XPath support (Sarissa)
– Serializing Java Beans as XML
    • XMLBeans, JAXB, Zeus, Jbind, Castor, Betwixt
– Serializing Java Beans as JavaScript objects
    • JSON -- JavaScript Object Notation
– 2-way Mapping of Java Beans to JavaScript objects
    • DWR -- Direct Web Remoting
– Ajax Component Libraries and Toolkits:
    • Dojo, Prototype, HTC, XBL
    • Implemented as JSP tag libraries or pure JavaScript
– Ajax Frameworks
– Ajax Patterns



                                                            13
QUESTIONS




http://ce.qu.edu.az/~aadamov
                               14

More Related Content

What's hot

Presto - Hadoop Conference Japan 2014
Presto - Hadoop Conference Japan 2014Presto - Hadoop Conference Japan 2014
Presto - Hadoop Conference Japan 2014Sadayuki Furuhashi
 
Meetup#2: Building responsive Symbology & Suggest WebService
Meetup#2: Building responsive Symbology & Suggest WebServiceMeetup#2: Building responsive Symbology & Suggest WebService
Meetup#2: Building responsive Symbology & Suggest WebServiceMinsk MongoDB User Group
 
Query handlingbytheserver
Query handlingbytheserverQuery handlingbytheserver
Query handlingbytheserver
sqlserver.co.il
 
Node proxy
Node proxyNode proxy
Node proxy
Ilya Starostin
 
Buildingsocialanalyticstoolwithmongodb
BuildingsocialanalyticstoolwithmongodbBuildingsocialanalyticstoolwithmongodb
BuildingsocialanalyticstoolwithmongodbMongoDB APAC
 
TPC-H in MongoDB
TPC-H in MongoDBTPC-H in MongoDB
TPC-H in MongoDB
Aung Thu Rha Hein
 
Intro to sbt-web
Intro to sbt-webIntro to sbt-web
Intro to sbt-web
Marius Soutier
 
Building a spa_in_30min
Building a spa_in_30minBuilding a spa_in_30min
Building a spa_in_30min
Michael Hackstein
 
Presto Meetup 2016 Small Start
Presto Meetup 2016 Small StartPresto Meetup 2016 Small Start
Presto Meetup 2016 Small Start
Hiroshi Toyama
 
Things you can find in the plan cache
Things you can find in the plan cacheThings you can find in the plan cache
Things you can find in the plan cachesqlserver.co.il
 
Presto in my_use_case
Presto in my_use_casePresto in my_use_case
Presto in my_use_case
wyukawa
 
Presto at Facebook - Presto Meetup @ Boston (10/6/2015)
Presto at Facebook - Presto Meetup @ Boston (10/6/2015)Presto at Facebook - Presto Meetup @ Boston (10/6/2015)
Presto at Facebook - Presto Meetup @ Boston (10/6/2015)
Martin Traverso
 
WebObjects Optimization
WebObjects OptimizationWebObjects Optimization
WebObjects OptimizationWO Community
 
4th Lecture: JSP and such
4th Lecture:  JSP and such4th Lecture:  JSP and such
4th Lecture: JSP and such
Manolis Vavalis
 
Scaling ArangoDB on Mesosphere DCOS
Scaling ArangoDB on Mesosphere DCOSScaling ArangoDB on Mesosphere DCOS
Scaling ArangoDB on Mesosphere DCOS
Max Neunhöffer
 
Running MongoDB 3.0 on AWS
Running MongoDB 3.0 on AWSRunning MongoDB 3.0 on AWS
Running MongoDB 3.0 on AWS
MongoDB
 
10 minutes fun with Cloud API comparison
10 minutes fun with Cloud API comparison10 minutes fun with Cloud API comparison
10 minutes fun with Cloud API comparison
Laurent Cerveau
 
OGDC Datastorage Solution_Mr.Dung, Dinh Nguyen Anh
OGDC Datastorage Solution_Mr.Dung, Dinh Nguyen AnhOGDC Datastorage Solution_Mr.Dung, Dinh Nguyen Anh
OGDC Datastorage Solution_Mr.Dung, Dinh Nguyen Anh
Buff Nguyen
 
Node.js and Cassandra
Node.js and CassandraNode.js and Cassandra
Node.js and Cassandra
Stratio
 
My Sql And Search At Craigslist
My Sql And Search At CraigslistMy Sql And Search At Craigslist
My Sql And Search At CraigslistMySQLConference
 

What's hot (20)

Presto - Hadoop Conference Japan 2014
Presto - Hadoop Conference Japan 2014Presto - Hadoop Conference Japan 2014
Presto - Hadoop Conference Japan 2014
 
Meetup#2: Building responsive Symbology & Suggest WebService
Meetup#2: Building responsive Symbology & Suggest WebServiceMeetup#2: Building responsive Symbology & Suggest WebService
Meetup#2: Building responsive Symbology & Suggest WebService
 
Query handlingbytheserver
Query handlingbytheserverQuery handlingbytheserver
Query handlingbytheserver
 
Node proxy
Node proxyNode proxy
Node proxy
 
Buildingsocialanalyticstoolwithmongodb
BuildingsocialanalyticstoolwithmongodbBuildingsocialanalyticstoolwithmongodb
Buildingsocialanalyticstoolwithmongodb
 
TPC-H in MongoDB
TPC-H in MongoDBTPC-H in MongoDB
TPC-H in MongoDB
 
Intro to sbt-web
Intro to sbt-webIntro to sbt-web
Intro to sbt-web
 
Building a spa_in_30min
Building a spa_in_30minBuilding a spa_in_30min
Building a spa_in_30min
 
Presto Meetup 2016 Small Start
Presto Meetup 2016 Small StartPresto Meetup 2016 Small Start
Presto Meetup 2016 Small Start
 
Things you can find in the plan cache
Things you can find in the plan cacheThings you can find in the plan cache
Things you can find in the plan cache
 
Presto in my_use_case
Presto in my_use_casePresto in my_use_case
Presto in my_use_case
 
Presto at Facebook - Presto Meetup @ Boston (10/6/2015)
Presto at Facebook - Presto Meetup @ Boston (10/6/2015)Presto at Facebook - Presto Meetup @ Boston (10/6/2015)
Presto at Facebook - Presto Meetup @ Boston (10/6/2015)
 
WebObjects Optimization
WebObjects OptimizationWebObjects Optimization
WebObjects Optimization
 
4th Lecture: JSP and such
4th Lecture:  JSP and such4th Lecture:  JSP and such
4th Lecture: JSP and such
 
Scaling ArangoDB on Mesosphere DCOS
Scaling ArangoDB on Mesosphere DCOSScaling ArangoDB on Mesosphere DCOS
Scaling ArangoDB on Mesosphere DCOS
 
Running MongoDB 3.0 on AWS
Running MongoDB 3.0 on AWSRunning MongoDB 3.0 on AWS
Running MongoDB 3.0 on AWS
 
10 minutes fun with Cloud API comparison
10 minutes fun with Cloud API comparison10 minutes fun with Cloud API comparison
10 minutes fun with Cloud API comparison
 
OGDC Datastorage Solution_Mr.Dung, Dinh Nguyen Anh
OGDC Datastorage Solution_Mr.Dung, Dinh Nguyen AnhOGDC Datastorage Solution_Mr.Dung, Dinh Nguyen Anh
OGDC Datastorage Solution_Mr.Dung, Dinh Nguyen Anh
 
Node.js and Cassandra
Node.js and CassandraNode.js and Cassandra
Node.js and Cassandra
 
My Sql And Search At Craigslist
My Sql And Search At CraigslistMy Sql And Search At Craigslist
My Sql And Search At Craigslist
 

Viewers also liked

INFORMATION TECHNOLOGIES AS THE BASE OF THE BUSINESS PROCESS MANAGEMENT IMPLE...
INFORMATION TECHNOLOGIES AS THE BASE OF THE BUSINESS PROCESS MANAGEMENT IMPLE...INFORMATION TECHNOLOGIES AS THE BASE OF THE BUSINESS PROCESS MANAGEMENT IMPLE...
INFORMATION TECHNOLOGIES AS THE BASE OF THE BUSINESS PROCESS MANAGEMENT IMPLE...
Abzetdin Adamov
 
Grid Computing
Grid ComputingGrid Computing
Grid Computing
Abzetdin Adamov
 
The Truth about Cloud Computing as new Paradigm in IT
The Truth about Cloud Computing  as new Paradigm in ITThe Truth about Cloud Computing  as new Paradigm in IT
The Truth about Cloud Computing as new Paradigm in ITAbzetdin Adamov
 
Internet google
Internet googleInternet google
Internet google
Collinwood
 
Brochure Acuna & Asociados
Brochure Acuna & AsociadosBrochure Acuna & Asociados
Brochure Acuna & Asociados
iacuna
 
Beyond Pattinson
Beyond PattinsonBeyond Pattinson
Beyond Pattinson
aurora70
 
Internet safty
Internet saftyInternet safty
Internet safty
Collinwood
 
Spiritual Geographies
Spiritual GeographiesSpiritual Geographies
Spiritual Geographies
aurora70
 
Üniversite Bilgi Sistemi - Birimlerin İşbirliği Platformu
Üniversite Bilgi Sistemi - Birimlerin İşbirliği PlatformuÜniversite Bilgi Sistemi - Birimlerin İşbirliği Platformu
Üniversite Bilgi Sistemi - Birimlerin İşbirliği Platformu
Abzetdin Adamov
 
Qafqaz university-inegrated-management-information-system
Qafqaz university-inegrated-management-information-systemQafqaz university-inegrated-management-information-system
Qafqaz university-inegrated-management-information-system
Abzetdin Adamov
 
e-Government Strategy. Government Transformation in Developing Countries of t...
e-Government Strategy. Government Transformation in Developing Countries of t...e-Government Strategy. Government Transformation in Developing Countries of t...
e-Government Strategy. Government Transformation in Developing Countries of t...Abzetdin Adamov
 
Big Data Ecosystem for Data-Driven Decision Making
Big Data Ecosystem for Data-Driven Decision MakingBig Data Ecosystem for Data-Driven Decision Making
Big Data Ecosystem for Data-Driven Decision Making
Abzetdin Adamov
 
The Role of Business Process Management in Success of the e-Government Projec...
The Role of Business Process Management in Success of the e-Government Projec...The Role of Business Process Management in Success of the e-Government Projec...
The Role of Business Process Management in Success of the e-Government Projec...Abzetdin Adamov
 
Big Data & Privacy
Big Data & PrivacyBig Data & Privacy
Big Data & Privacy
Abzetdin Adamov
 
Latest Trends in Technology: BigData Analytics, Virtualization, Cloud Computi...
Latest Trends in Technology:BigData Analytics, Virtualization, Cloud Computi...Latest Trends in Technology:BigData Analytics, Virtualization, Cloud Computi...
Latest Trends in Technology: BigData Analytics, Virtualization, Cloud Computi...
Abzetdin Adamov
 
Introduction to object oriented programming
Introduction to object oriented programmingIntroduction to object oriented programming
Introduction to object oriented programmingAbzetdin Adamov
 
University Management Information System
University Management Information SystemUniversity Management Information System
University Management Information System
Abzetdin Adamov
 

Viewers also liked (18)

INFORMATION TECHNOLOGIES AS THE BASE OF THE BUSINESS PROCESS MANAGEMENT IMPLE...
INFORMATION TECHNOLOGIES AS THE BASE OF THE BUSINESS PROCESS MANAGEMENT IMPLE...INFORMATION TECHNOLOGIES AS THE BASE OF THE BUSINESS PROCESS MANAGEMENT IMPLE...
INFORMATION TECHNOLOGIES AS THE BASE OF THE BUSINESS PROCESS MANAGEMENT IMPLE...
 
Grid Computing
Grid ComputingGrid Computing
Grid Computing
 
The Truth about Cloud Computing as new Paradigm in IT
The Truth about Cloud Computing  as new Paradigm in ITThe Truth about Cloud Computing  as new Paradigm in IT
The Truth about Cloud Computing as new Paradigm in IT
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
 
Internet google
Internet googleInternet google
Internet google
 
Brochure Acuna & Asociados
Brochure Acuna & AsociadosBrochure Acuna & Asociados
Brochure Acuna & Asociados
 
Beyond Pattinson
Beyond PattinsonBeyond Pattinson
Beyond Pattinson
 
Internet safty
Internet saftyInternet safty
Internet safty
 
Spiritual Geographies
Spiritual GeographiesSpiritual Geographies
Spiritual Geographies
 
Üniversite Bilgi Sistemi - Birimlerin İşbirliği Platformu
Üniversite Bilgi Sistemi - Birimlerin İşbirliği PlatformuÜniversite Bilgi Sistemi - Birimlerin İşbirliği Platformu
Üniversite Bilgi Sistemi - Birimlerin İşbirliği Platformu
 
Qafqaz university-inegrated-management-information-system
Qafqaz university-inegrated-management-information-systemQafqaz university-inegrated-management-information-system
Qafqaz university-inegrated-management-information-system
 
e-Government Strategy. Government Transformation in Developing Countries of t...
e-Government Strategy. Government Transformation in Developing Countries of t...e-Government Strategy. Government Transformation in Developing Countries of t...
e-Government Strategy. Government Transformation in Developing Countries of t...
 
Big Data Ecosystem for Data-Driven Decision Making
Big Data Ecosystem for Data-Driven Decision MakingBig Data Ecosystem for Data-Driven Decision Making
Big Data Ecosystem for Data-Driven Decision Making
 
The Role of Business Process Management in Success of the e-Government Projec...
The Role of Business Process Management in Success of the e-Government Projec...The Role of Business Process Management in Success of the e-Government Projec...
The Role of Business Process Management in Success of the e-Government Projec...
 
Big Data & Privacy
Big Data & PrivacyBig Data & Privacy
Big Data & Privacy
 
Latest Trends in Technology: BigData Analytics, Virtualization, Cloud Computi...
Latest Trends in Technology:BigData Analytics, Virtualization, Cloud Computi...Latest Trends in Technology:BigData Analytics, Virtualization, Cloud Computi...
Latest Trends in Technology: BigData Analytics, Virtualization, Cloud Computi...
 
Introduction to object oriented programming
Introduction to object oriented programmingIntroduction to object oriented programming
Introduction to object oriented programming
 
University Management Information System
University Management Information SystemUniversity Management Information System
University Management Information System
 

Similar to Introduction to AJAX

Simple introduction to AJAX and how to useppt
Simple introduction to AJAX and how to usepptSimple introduction to AJAX and how to useppt
Simple introduction to AJAX and how to useppt
abohmezoh
 
Learn AJAX at ASIT
Learn AJAX at ASITLearn AJAX at ASIT
Learn AJAX at ASIT
ASIT
 
Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajax
Nir Elbaz
 
Synapseindia dot net development web applications with ajax
Synapseindia dot net development  web applications with ajaxSynapseindia dot net development  web applications with ajax
Synapseindia dot net development web applications with ajax
Synapseindiappsdevelopment
 
AJAX.pptx
AJAX.pptxAJAX.pptx
AJAX.pptx
Ganesh Chavan
 
Ajax tutorial by bally chohan
Ajax tutorial by bally chohanAjax tutorial by bally chohan
Ajax tutorial by bally chohan
WebVineet
 
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 workshop
Ajax workshopAjax workshop
Ajax workshop
WBUTTUTORIALS
 
Ajax xml json
Ajax xml jsonAjax xml json
Ajax xml json
Andrii Siusko
 
Ajax
AjaxAjax
Unit-5.pptx
Unit-5.pptxUnit-5.pptx
Unit-5.pptx
itzkuu01
 
AWS (Hadoop) Meetup 30.04.09
AWS (Hadoop) Meetup 30.04.09AWS (Hadoop) Meetup 30.04.09
AWS (Hadoop) Meetup 30.04.09
Chris Purrington
 
AWS as platform for scalable applications
AWS as platform for scalable applicationsAWS as platform for scalable applications
AWS as platform for scalable applications
Roman Gomolko
 
Ajax introduction
Ajax introductionAjax introduction
Ajax introduction
sjmittal
 

Similar to Introduction to AJAX (20)

Simple introduction to AJAX and how to useppt
Simple introduction to AJAX and how to usepptSimple introduction to AJAX and how to useppt
Simple introduction to AJAX and how to useppt
 
Learn AJAX at ASIT
Learn AJAX at ASITLearn AJAX at ASIT
Learn AJAX at ASIT
 
Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajax
 
Synapseindia dot net development web applications with ajax
Synapseindia dot net development  web applications with ajaxSynapseindia dot net development  web applications with ajax
Synapseindia dot net development web applications with ajax
 
Ajax
AjaxAjax
Ajax
 
AJAX.pptx
AJAX.pptxAJAX.pptx
AJAX.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
 
PHP - Introduction to PHP AJAX
PHP -  Introduction to PHP AJAXPHP -  Introduction to PHP AJAX
PHP - Introduction to PHP AJAX
 
Ajax workshop
Ajax workshopAjax workshop
Ajax workshop
 
Ajax xml json
Ajax xml jsonAjax xml json
Ajax xml json
 
AJAX
AJAXAJAX
AJAX
 
Ajax
AjaxAjax
Ajax
 
Unit-5.pptx
Unit-5.pptxUnit-5.pptx
Unit-5.pptx
 
AWS (Hadoop) Meetup 30.04.09
AWS (Hadoop) Meetup 30.04.09AWS (Hadoop) Meetup 30.04.09
AWS (Hadoop) Meetup 30.04.09
 
Ajax Tuturial
Ajax TuturialAjax Tuturial
Ajax Tuturial
 
Ajax
AjaxAjax
Ajax
 
AWS as platform for scalable applications
AWS as platform for scalable applicationsAWS as platform for scalable applications
AWS as platform for scalable applications
 
Ajax introduction
Ajax introductionAjax introduction
Ajax introduction
 

Introduction to AJAX

  • 1. Internet Technologies Introduction to AJAX Dr. Abzetdin ADAMOV Chair of Computer Engineering Department aadamov@qu.edu.az http://ce.qu.edu.az/~aadamov
  • 2. What is Ajax? • "Asynchronous JavaScript and XML" • New name for an old technique: – JavaScript + DHTML + XMLHttpRequest – In use since at least 1997 – Finally someone gave it a name – Already enabled in your Web server and browser • Use JavaScript asynchronously behind the scenes to load additional data (typically XML) without discarding and reloading the entire Web page. 2
  • 3. Why use Ajax? • Your users will soon demand it – Not just another cool (geeky) technology – Very user-visible effect – Rich UI experience in a Web page • Portable across browsers • Plus, all advantages of zero-install Web app – No install done for this demo – No "DLL Hell" 3
  • 4. Why use Ajax? • Client/Server Apps: – Dynamic data – Static forms, controls, code, etc. – Efficient, but not flexible • Traditional Web Apps: – Dynamic data – Dynamic forms, controls, code, etc. – Flexible, but inefficient, and noticeably slow • Ajax Apps: – Dynamic data – Static or dynamic forms, controls, code, etc. – Best of both worlds 4
  • 5. Why use Ajax? • Geeky reasons: – Multithreaded data retrieval from Web servers • Pre-fetch data before needed • Progress indicators • Appearance of speed • Avoids need for setTimeout() – Less bandwidth required; less server load • Reload partial page, not entire page • Load data only, not even partial page 5
  • 6. How much to use Ajax? • As little or as much as you like • No need to abandon what you already do • One more item in your "bag of tricks" • Start by jazzing up your existing UI 6
  • 7. How to use Ajax? Simple! Use the XMLHttpRequest Object 7
  • 8. XMLHttpRequest Methods • open (“method”, “URL”, [async, username, password]) – Assigns destination URL, method, etc. • send (params) – Sends request including postable string or DOM object data • abort () – Terminates current request • getAllResponseHeaders () – Returns headers (name/value pairs) as a string • getResponseHeader (“header”) – Returns value of a given header • setRequestHeader (“label”,”value”) – Sets Request Headers before sending 8
  • 9. XMLHttpRequest Properties • onreadystatechange – Event handler (your code) that fires at each state change • readyState 0 = uninitialized 3 = interactive (some data has been returned) 1 = loading (broken in IE 6.0) 2 = loaded 4 = complete • status – HTTP Status returned from server: 200-299 = OK • responseText – String version of data returned from server • responseXML – XML DOM document of data returned • statusText – Status text returned from server 9
  • 10. Simple Example var req = new XMLHttpRequest(); req.onreadystatechange = myHandler; req.open("GET", "servlet", true); req.send("p1=abc"); ... function myHandler() { if (req.readyState == 4) { doSomethingWith(req.responseXML); } else if (req.readyState == 3) { showProgressIndicator(); } } 10
  • 11. Demos • http://studlinux.qafqaz.local/~s08_aaz/ajax – Simple demo – More demos – Google Suggest – Google Maps – Language translation – Mouse gesture as password – Typing speed as password – Classified ads tied to map – "Mashups" 11
  • 12. Security Issues • Can only hit domain the Web page came from – Cannot access a 3rd party Web Service – However: • You can wrap those requests through your own server • User can allow access to specific sites via browser security settings • IFRAME can access any site (instead of XMLHttpRequest) 12
  • 13. Advanced Topics – XSLT and XPath support (Sarissa) – Serializing Java Beans as XML • XMLBeans, JAXB, Zeus, Jbind, Castor, Betwixt – Serializing Java Beans as JavaScript objects • JSON -- JavaScript Object Notation – 2-way Mapping of Java Beans to JavaScript objects • DWR -- Direct Web Remoting – Ajax Component Libraries and Toolkits: • Dojo, Prototype, HTC, XBL • Implemented as JSP tag libraries or pure JavaScript – Ajax Frameworks – Ajax Patterns 13