SlideShare a Scribd company logo
1 of 12
Web Technology Introduction
Collin Smith (Dec. 16, 2006)
AJAX
AJAX Outline
• What is AJAX?
• Benefits
• Real world examples
• How it works
• Code review
• Samples
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
Benefits
• 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 Examples
• Google Maps (http://maps.google.com/)
(slidable maps)
• My Yahoo! (http://my.yahoo.com/) (shuffling
windows)
How 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 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 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 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 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 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)
References
• http://en.wikipedia.org/wiki/Ajax_
%28programming%29
• http://www.w3schools.com/ajax/default.asp

More Related Content

What's hot

What's hot (20)

Overview of AJAX
Overview of AJAXOverview of AJAX
Overview of AJAX
 
Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajax
 
Ajax
AjaxAjax
Ajax
 
Ajax Presentation
Ajax PresentationAjax Presentation
Ajax Presentation
 
Ajax Ppt
Ajax PptAjax Ppt
Ajax Ppt
 
nodejs
nodejsnodejs
nodejs
 
Ajax
Ajax Ajax
Ajax
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
Serverless GraphQL. AppSync 101
Serverless GraphQL. AppSync 101Serverless GraphQL. AppSync 101
Serverless GraphQL. AppSync 101
 
AJAX
AJAXAJAX
AJAX
 
Join semantics in kafka streams
Join semantics in kafka streamsJoin semantics in kafka streams
Join semantics in kafka streams
 
Logging in The World of DevOps
Logging in The World of DevOps Logging in The World of DevOps
Logging in The World of DevOps
 
Introduction to cloud computing
Introduction to cloud computingIntroduction to cloud computing
Introduction to cloud computing
 
Cloud Abstraction Libraries: Implementation and Comparison
Cloud Abstraction Libraries: Implementation and ComparisonCloud Abstraction Libraries: Implementation and Comparison
Cloud Abstraction Libraries: Implementation and Comparison
 
RxJS streams handling for Padawan
RxJS streams handling for PadawanRxJS streams handling for Padawan
RxJS streams handling for Padawan
 
Part Two: Building Web Apps with the MERN Stack
Part Two: Building Web Apps with the MERN StackPart Two: Building Web Apps with the MERN Stack
Part Two: Building Web Apps with the MERN Stack
 
Asp.Net MVC
Asp.Net MVCAsp.Net MVC
Asp.Net MVC
 
Taste of RxJS
Taste of RxJSTaste of RxJS
Taste of RxJS
 
Ruby onrails overview
Ruby onrails overviewRuby onrails overview
Ruby onrails overview
 

Similar to Ajax (20)

Ajax Introduction
Ajax IntroductionAjax Introduction
Ajax Introduction
 
AJAX.pptx
AJAX.pptxAJAX.pptx
AJAX.pptx
 
Ajax ppt
Ajax pptAjax ppt
Ajax ppt
 
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
Ajax Ajax
Ajax
 
Ajax
AjaxAjax
Ajax
 
javaScript and jQuery
javaScript and jQueryjavaScript and jQuery
javaScript and jQuery
 
Ajax
AjaxAjax
Ajax
 
Learn AJAX at ASIT
Learn AJAX at ASITLearn AJAX at ASIT
Learn AJAX at ASIT
 
AJAX Introduction [Autosaved].pptx
AJAX Introduction [Autosaved].pptxAJAX Introduction [Autosaved].pptx
AJAX Introduction [Autosaved].pptx
 
ITI006En-AJAX
ITI006En-AJAXITI006En-AJAX
ITI006En-AJAX
 
WEB TECHNOLOGY Unit-5.pptx
WEB TECHNOLOGY Unit-5.pptxWEB TECHNOLOGY Unit-5.pptx
WEB TECHNOLOGY Unit-5.pptx
 
Ajax Tuturial
Ajax TuturialAjax Tuturial
Ajax Tuturial
 
Ajax
AjaxAjax
Ajax
 
Introduction to AJAX
Introduction to AJAXIntroduction to AJAX
Introduction to AJAX
 
Ajax
AjaxAjax
Ajax
 
AJAX
AJAXAJAX
AJAX
 

More from WBUTTUTORIALS

Software testing-and-analysis
Software testing-and-analysisSoftware testing-and-analysis
Software testing-and-analysisWBUTTUTORIALS
 
Fuzzy logic-introduction
Fuzzy logic-introductionFuzzy logic-introduction
Fuzzy logic-introductionWBUTTUTORIALS
 
Failure mode-and-effects-analysis
Failure mode-and-effects-analysisFailure mode-and-effects-analysis
Failure mode-and-effects-analysisWBUTTUTORIALS
 
Direct memory access
Direct memory accessDirect memory access
Direct memory accessWBUTTUTORIALS
 
Cost volume-profit-relationships
Cost volume-profit-relationshipsCost volume-profit-relationships
Cost volume-profit-relationshipsWBUTTUTORIALS
 
Control unit-implementation
Control unit-implementationControl unit-implementation
Control unit-implementationWBUTTUTORIALS
 
Query processing-and-optimization
Query processing-and-optimizationQuery processing-and-optimization
Query processing-and-optimizationWBUTTUTORIALS
 
Data communications-concepts
Data communications-conceptsData communications-concepts
Data communications-conceptsWBUTTUTORIALS
 
Ajax toolkit-framework
Ajax toolkit-frameworkAjax toolkit-framework
Ajax toolkit-frameworkWBUTTUTORIALS
 

More from WBUTTUTORIALS (12)

Software testing-and-analysis
Software testing-and-analysisSoftware testing-and-analysis
Software testing-and-analysis
 
Query optimisation
Query optimisationQuery optimisation
Query optimisation
 
Fuzzy logic-introduction
Fuzzy logic-introductionFuzzy logic-introduction
Fuzzy logic-introduction
 
Failure mode-and-effects-analysis
Failure mode-and-effects-analysisFailure mode-and-effects-analysis
Failure mode-and-effects-analysis
 
Direct memory access
Direct memory accessDirect memory access
Direct memory access
 
Cost volume-profit-relationships
Cost volume-profit-relationshipsCost volume-profit-relationships
Cost volume-profit-relationships
 
Control unit-implementation
Control unit-implementationControl unit-implementation
Control unit-implementation
 
Relational model
Relational modelRelational model
Relational model
 
Query processing-and-optimization
Query processing-and-optimizationQuery processing-and-optimization
Query processing-and-optimization
 
Data communications-concepts
Data communications-conceptsData communications-concepts
Data communications-concepts
 
Ajax workshop
Ajax workshopAjax workshop
Ajax workshop
 
Ajax toolkit-framework
Ajax toolkit-frameworkAjax toolkit-framework
Ajax toolkit-framework
 

Recently uploaded

This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 

Recently uploaded (20)

This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 

Ajax

  • 1. Web Technology Introduction Collin Smith (Dec. 16, 2006) AJAX
  • 2. AJAX Outline • What is AJAX? • Benefits • Real world examples • How it works • Code review • Samples
  • 3. 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. Benefits • 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 Examples • Google Maps (http://maps.google.com/) (slidable maps) • My Yahoo! (http://my.yahoo.com/) (shuffling windows)
  • 6. How 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 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 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 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 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 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)