SlideShare ist ein Scribd-Unternehmen logo
1 von 12
Web Technology Introduction
Collin Smith (Dec. 16, 2006)
AJAXAJAX
AJAX OutlineAJAX Outline
 What is AJAX?
 Benefits
 Real world examples
 How it works
 Code review
 Samples
What is AJAX?What is AJAX?
 Asynchronous JavaScript and XML(AJAX)
 Web development technique for creating web applications
 Makes web pages more responsive by exchanging small
amounts of data
 Allows the web page to change its content without
refreshing the whole page
 A web browser technology independent of web server
software
BenefitsBenefits
 Improves the user experience
 Analyzing information typed into browser in real time
 Provide a richer experience
 Increases responsiveness of web pages
 Improve bandwidth utilization
 Only data which is required is retrieved from the server
Real World ExamplesReal World Examples
 Google Maps (http://maps.google.com/) (slidable maps)
 My Yahoo! (http://my.yahoo.com/) (shuffling windows)
How it worksHow it works
 AJAX runs in your browser
 Works with asynchronous data transfers(HTTP requests)
between the browser and the web server
 Http requests are sent by javascript calls without having to
submit a form
 XML is commonly used as the format for receiving server
data but plain text may be used as well
1 – XMLHttpRequest object1 – XMLHttpRequest object
 A page element must make a javascript call
 The javascript function must create an XMLHttpRequest
object which is used to contact the server
 Javascript must determine whether the client is IE or
Firefox
 http = new ActiveXObject("Microsoft.XMLHTTP"); (IE)
 http = new XMLHttpRequest(); (Mozilla)
2 - Sending the request2 - Sending the request
 Once the XMLHttpRequest object has been created it must
be set up to call the server
 http.open("GET", serverurl, true);
 http.onreadystatechange = jsMethodToHandleResponse;
 http.send(null);
 The code above utilizes the XMLHttpRequest object to
contact the server and retrieve server data
 When the response returns the javascript method
jsMethodToHandleResponse can update the page
3 - Handling the Response3 - Handling the Response
 Implementation of the javascript method which will be used
to handle the response (Event Handler)
 function jsMethodToHandleResponse(str)
 {
 //simply take the response returned an update an html
element with the returned value from the server
 document.getElementById("result").innerHTML = str;
 }
 Now the page has communicated with the server without
having to refresh the entire page
readyState propertyreadyState property
 The XMLHttpRequest readyState property defines the
current state of the XMLHttpRequest object
 Possible values for the readyState
 Usually we are usually only concerned with state 4
State Description
0 The request is not initialized
1 The request has been setup
2 The request has been submitted
3 The request is in process
4 The request is completed
Sample CodeSample Code
 Simply unzip the sample code into a JSP Location and go
to index.jsp
 There are various examples that show some AJAX
functionality
 It is all JSP to make it easy to setup and easy to see the
code.
 The JSPs are generic enough to be easily to converted to
other technologies (.NET or PHP)
ReferencesReferences
 http://en.wikipedia.org/wiki/Ajax_%28programming%29
 http://www.w3schools.com/ajax/default.asp

Weitere ähnliche Inhalte

Was ist angesagt? (20)

Ajax.ppt
Ajax.pptAjax.ppt
Ajax.ppt
 
jQuery Ajax
jQuery AjaxjQuery Ajax
jQuery Ajax
 
Simplify AJAX using jQuery
Simplify AJAX using jQuerySimplify AJAX using jQuery
Simplify AJAX using jQuery
 
Xml http request
Xml http requestXml http request
Xml http request
 
Ajax
AjaxAjax
Ajax
 
Ajax and xml
Ajax and xmlAjax and xml
Ajax and xml
 
Ajax ppt
Ajax pptAjax ppt
Ajax ppt
 
Asynchronous JavaScript & XML (AJAX)
Asynchronous JavaScript & XML (AJAX)Asynchronous JavaScript & XML (AJAX)
Asynchronous JavaScript & XML (AJAX)
 
Architecture in Ajax Applications
Architecture in Ajax ApplicationsArchitecture in Ajax Applications
Architecture in Ajax Applications
 
Understanding AJAX
Understanding AJAXUnderstanding AJAX
Understanding AJAX
 
Ajax presentation
Ajax presentationAjax presentation
Ajax presentation
 
Ajax presentation
Ajax presentationAjax presentation
Ajax presentation
 
KMI System
KMI SystemKMI System
KMI System
 
Using Ajax In Domino Web Applications
Using Ajax In Domino Web ApplicationsUsing Ajax In Domino Web Applications
Using Ajax In Domino Web Applications
 
Rethinking Syncing at AltConf 2019
Rethinking Syncing at AltConf 2019Rethinking Syncing at AltConf 2019
Rethinking Syncing at AltConf 2019
 
Database c# connetion
Database c# connetionDatabase c# connetion
Database c# connetion
 
Introducing CouchDB
Introducing CouchDBIntroducing CouchDB
Introducing CouchDB
 
2310 b 12
2310 b 122310 b 12
2310 b 12
 
Beyond the page
Beyond the pageBeyond the page
Beyond the page
 
Ajax ppt
Ajax pptAjax ppt
Ajax ppt
 

Andere mochten auch

Andere mochten auch (6)

AJAX Crawl
AJAX CrawlAJAX Crawl
AJAX Crawl
 
Ajax Introduction
Ajax IntroductionAjax Introduction
Ajax Introduction
 
Photo essay danshanique adkins
Photo essay danshanique adkinsPhoto essay danshanique adkins
Photo essay danshanique adkins
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 

Ähnlich wie Ajax Introduction (20)

Ajax
AjaxAjax
Ajax
 
Mashup
MashupMashup
Mashup
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
Ajax tutorial by bally chohan
Ajax tutorial by bally chohanAjax tutorial by bally chohan
Ajax tutorial by bally chohan
 
Ajax
Ajax Ajax
Ajax
 
AJAX.pptx
AJAX.pptxAJAX.pptx
AJAX.pptx
 
M Ramya
M RamyaM Ramya
M Ramya
 
Unit-5.pptx
Unit-5.pptxUnit-5.pptx
Unit-5.pptx
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
Ajax Tuturial
Ajax TuturialAjax Tuturial
Ajax Tuturial
 
AJAX
AJAXAJAX
AJAX
 
Copy of ajax tutorial
Copy of ajax tutorialCopy of ajax tutorial
Copy of ajax tutorial
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
AJAX
AJAXAJAX
AJAX
 

Kürzlich hochgeladen

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 

Kürzlich hochgeladen (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

Ajax Introduction

  • 1. Web Technology Introduction Collin Smith (Dec. 16, 2006) AJAXAJAX
  • 2. AJAX OutlineAJAX Outline  What is AJAX?  Benefits  Real world examples  How it works  Code review  Samples
  • 3. What is AJAX?What is AJAX?  Asynchronous JavaScript and XML(AJAX)  Web development technique for creating web applications  Makes web pages more responsive by exchanging small amounts of data  Allows the web page to change its content without refreshing the whole page  A web browser technology independent of web server software
  • 4. BenefitsBenefits  Improves the user experience  Analyzing information typed into browser in real time  Provide a richer experience  Increases responsiveness of web pages  Improve bandwidth utilization  Only data which is required is retrieved from the server
  • 5. Real World ExamplesReal World Examples  Google Maps (http://maps.google.com/) (slidable maps)  My Yahoo! (http://my.yahoo.com/) (shuffling windows)
  • 6. How it worksHow it works  AJAX runs in your browser  Works with asynchronous data transfers(HTTP requests) between the browser and the web server  Http requests are sent by javascript calls without having to submit a form  XML is commonly used as the format for receiving server data but plain text may be used as well
  • 7. 1 – XMLHttpRequest object1 – XMLHttpRequest object  A page element must make a javascript call  The javascript function must create an XMLHttpRequest object which is used to contact the server  Javascript must determine whether the client is IE or Firefox  http = new ActiveXObject("Microsoft.XMLHTTP"); (IE)  http = new XMLHttpRequest(); (Mozilla)
  • 8. 2 - Sending the request2 - Sending the request  Once the XMLHttpRequest object has been created it must be set up to call the server  http.open("GET", serverurl, true);  http.onreadystatechange = jsMethodToHandleResponse;  http.send(null);  The code above utilizes the XMLHttpRequest object to contact the server and retrieve server data  When the response returns the javascript method jsMethodToHandleResponse can update the page
  • 9. 3 - Handling the Response3 - Handling the Response  Implementation of the javascript method which will be used to handle the response (Event Handler)  function jsMethodToHandleResponse(str)  {  //simply take the response returned an update an html element with the returned value from the server  document.getElementById("result").innerHTML = str;  }  Now the page has communicated with the server without having to refresh the entire page
  • 10. readyState propertyreadyState property  The XMLHttpRequest readyState property defines the current state of the XMLHttpRequest object  Possible values for the readyState  Usually we are usually only concerned with state 4 State Description 0 The request is not initialized 1 The request has been setup 2 The request has been submitted 3 The request is in process 4 The request is completed
  • 11. Sample CodeSample Code  Simply unzip the sample code into a JSP Location and go to index.jsp  There are various examples that show some AJAX functionality  It is all JSP to make it easy to setup and easy to see the code.  The JSPs are generic enough to be easily to converted to other technologies (.NET or PHP)