SlideShare a Scribd company logo
An Introduction to  Ajax Programming Dr. Harry Chen CMSC 491S/691S March 5, 2008
Agenda What’s Ajax? (revisit) JavaScript in 10 minutes DOM and XMLHttpRequest Programming Ajax with Mochikit Ajax Pitfalls Ajax in gnizr
Ajax A synchronous  J avaScript  A nd  X ML The idea is to enable interactive Web pages without requiring the browser to refresh. Browser JavaScript code Web Server “ Give me some data” “ Here, data” Modify the page content, without refreshing the page
Ajax vs. tradition HTTP paradigm  In the tradition HTTP world Every request results in a new page loading Dynamic pages are created on the server-side Data, format and styling are done on the server In the Ajax world The result of an Ajax call may only change a small parts of an existing HTML page Server sets up the page structure, JavaScript code performs the content creation Data, format and styling are done via JavaScript (CSS and XHTML)
Ajax is a 3-Legged Stool XHTML JavaScript CSS Ajax Adopted from Simon Wilson: http://www.slideshare.net/simon/how-to-make-ajax-work-for-you
JavaScript in 10 minutes Examples adopted from http://www.w3schools.com/js/js_examples.asp
Say “hello world” What’s ‘document’?
Write into HTML <body/> ‘ document ’ is a predefined JavaScript variable that represents the entire HTML document.  You can read from and write to the current document via this ‘ document ’ variable.
Loading JavaScript code Two ways to load your JS code Inline within the same HTML document From a separate file on the server e.g., Replace ‘xxx.js’ with http://path/to/myprogram.js
Define variables
Define Array and Associative Array
Function
Assign Function to a Variable In JavaScript, you can assign function to a variable.
Additional Resource JavaScript Tutorial http://www.w3schools.com/js/ PPK on JavaScript http://www.quirksmode.org/ I love it!
DOM and XMLHttpRequest
DOM Document Object Model All XHTML doc are XML doc DOM is a process-model for XML  For reading and writing XML doc We can use DOM to manipulate XHTML
DOM Tree http://flickr.com/photos/13571173@N00/411653343/
An XML DOM (not XHTML) <bookstore> <book category=“c1”> <title lang=“en”>Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price>  </book> </bookstore>
HTML DOM Tree – an example
JavaScript DOM Browser’s JS engines provides predefine HTML DOM objects
‘Document’ DOM Predefined objects come with predefined properties and methods http://www.w3schools.com/htmldom/dom_obj_document.asp Watch out for browser support!
DOM Manipulation Operations for manipulating DOM objects are similar in different programming langauges – e.g., Java, PHP and JavaScript. Tutorial http://www.w3schools.com/dom/default.asp
XMLHttpRequest Is a specification (see W3C doc) Defines an API that provides scripted client functionality for transferring data between a client and a server Browser JavaScript code Web Server “ Give me some data” “ Here, data.” Modify the page content, without refreshing the page Done via  XMLHttpRequest
Clarification Use XMLHttpRequest to  send  and  receive  data from servers via HTTP Data sent and received can be any text format, not just XML. Works over HTTP and HTTPS http://www.w3.org/TR/XMLHttpRequest/
Fetch XML Data from the Server http://www.w3.org/TR/XMLHttpRequest/
Send data using XMLHttpRequest http://www.w3.org/TR/XMLHttpRequest/
Common Problems with  DOM and XMLHttpRequest
XMLHttpRequest Cross-browser Issues Most browsers support the standard implementation, but some provide extra support that others don’t. Firefox implements standard and more IE implements just the standard
XMLHttpRequest Creation Creating an XMLHttpRequest object is done differently depending on the browser. Checks which browser the client is using! Crazy!
DOM Cross-browser issues DOM API differs from browser to brower. Remember this chart?
Get Node Value – FF vs. IE
Additional Reading AJAX - Common Pitfalls http://grover.open2space.com/node/92
Ajax Programming with Mochikit
JavaScript Libraries To make JavaScript developer more productive, many JS libraries have been created. MochiKit    I prefer; light-weight and simple jQuery Yahoo! UI library Prototype Script.aculo.us
MochiKit A collection API that simplify JavaScript programming “Makes JavaScript suck a bit less” http://www.mochikit.com
Load MochiKit All API can be loaded from a single file <script type=&quot;text/javascript&quot; src=&quot;MochiKit.js&quot;></script> 
What does MochiKit provide?  Ajax programmers look here!
Fetch JSON Data from the Server The location of the data. Instantiate a function for making the call. Define how we want to handle the “response”. Actually makes the call.
What we didn’t do! We didn’t have to create the XMLHttpRequest object ourselves. Don’t have to worry about those cross-browser issues. We don’t have to deal with HTTP methods -- “PUT”, “GET” etc.
Additional Reading Reading MochiKit’s doc for How to manipulate DOM  How to change CSS style How to deal with asynchronous events How to enable Drag and Drop How to exploit JavaScript functional and OO programming
Ajax Pitfalls
Ajax Programming Issues Breaking the back button Not giving immediate visual cues for clicking widgets “Did I click?”, “I thought I have clicked”
Data loading issues Loading… Please wait… (after 3 secs) I’m still loading. Please wait… (after 5 secs)  I’m still loading. Please wait.. (after 30 secs) User: forget you. I’m leaving.
JavaScript Code Loading Issue  Too much JavaScript code can slow down the performance the client browser.  Only use JavaScript and Ajax when it is necessary. More code != Better program
Search Crawler Issue Text content rendered by JavaScript is not accessible to search crawler. Empty page?
Accessibility  Not all screenreaders are built to work with Ajax applications. http://www.sitepoint.com/article/ajax-screenreaders-work
Summary Ajax programming can make Web pages to be more interactive and responsive.  XHTML, CSS and JavaScript are the key components Ajax Ajax uses XMLHttpRequest object to send and receive data Study Ajax Pitfalls can help you to build more effective Mashup and Web 2.0 apps.
Ajax Programming in gnizr

More Related Content

What's hot (20)

Ajax Ppt 1
Ajax Ppt 1Ajax Ppt 1
Ajax Ppt 1
JayaPrakash.m
 
PHP - Introduction to PHP AJAX
PHP -  Introduction to PHP AJAXPHP -  Introduction to PHP AJAX
PHP - Introduction to PHP AJAX
Vibrant Technologies & Computers
 
Ajax and PHP
Ajax and PHPAjax and PHP
Ajax and PHP
John Coggeshall
 
Ajax ppt
Ajax pptAjax ppt
Ajax ppt
OECLIB Odisha Electronics Control Library
 
Ajax
AjaxAjax
Ajax
Nishanthyadav Nishanth
 
Ajax Presentation
Ajax PresentationAjax Presentation
Ajax Presentation
jrdoane
 
Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajax
Venkat Pinagadi
 
Introduction to ajax
Introduction  to  ajaxIntroduction  to  ajax
Introduction to ajax
Pihu Goel
 
AJAX
AJAXAJAX
AJAX
Mukesh Tekwani
 
Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajax
Nir Elbaz
 
Asynchronous JavaScript & XML (AJAX)
Asynchronous JavaScript & XML (AJAX)Asynchronous JavaScript & XML (AJAX)
Asynchronous JavaScript & XML (AJAX)
Adnan Sohail
 
Ajax ppt - 32 slides
Ajax ppt - 32 slidesAjax ppt - 32 slides
Ajax ppt - 32 slides
Smithss25
 
Ajax PPT
Ajax PPTAjax PPT
Ajax PPT
Hub4Tech.com
 
Ajax
AjaxAjax
Ajax
Sanoj Kumar
 
Ajax:From Desktop Applications towards Ajax Web Applications
Ajax:From Desktop Applications towards Ajax Web ApplicationsAjax:From Desktop Applications towards Ajax Web Applications
Ajax:From Desktop Applications towards Ajax Web Applications
Siva Kumar
 
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 presentation
Ajax presentationAjax presentation
Ajax presentation
engcs2008
 
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
 
Jquery Ajax
Jquery AjaxJquery Ajax
Jquery Ajax
Anand Kumar Rajana
 
Ajax
AjaxAjax
Ajax
Dumindu Pahalawatta
 

Viewers also liked (17)

Building Applications Using Ajax
Building Applications Using AjaxBuilding Applications Using Ajax
Building Applications Using Ajax
s_pradeep
 
JSON: The Basics
JSON: The BasicsJSON: The Basics
JSON: The Basics
Jeff Fox
 
Ajax basics
Ajax basicsAjax basics
Ajax basics
amanrahulraj
 
AJAX - An introduction
AJAX - An introductionAJAX - An introduction
AJAX - An introduction
Eleonora Ciceri
 
Jsf Ajax
Jsf AjaxJsf Ajax
Jsf Ajax
rajivmordani
 
Introduction to AJAX In WordPress
Introduction to AJAX In WordPressIntroduction to AJAX In WordPress
Introduction to AJAX In WordPress
Caldera Labs
 
Fourth Dimension Level 1
Fourth Dimension Level 1Fourth Dimension Level 1
Fourth Dimension Level 1
Ehtesham Mirxa
 
MachinePulse Products
MachinePulse ProductsMachinePulse Products
MachinePulse Products
MachinePulse
 
WebApp / SPA @ AllFacebook Developer Conference
WebApp / SPA @ AllFacebook Developer ConferenceWebApp / SPA @ AllFacebook Developer Conference
WebApp / SPA @ AllFacebook Developer Conference
AllFacebook.de
 
Intro to SPA using JavaScript & ASP.NET
Intro to SPA using JavaScript & ASP.NETIntro to SPA using JavaScript & ASP.NET
Intro to SPA using JavaScript & ASP.NET
Alan Hecht
 
Writing SPA in 2017
Writing SPA in 2017Writing SPA in 2017
Writing SPA in 2017
Arek Flinik
 
Ajax by Examples 2
Ajax by Examples 2Ajax by Examples 2
Ajax by Examples 2
Yenwen Feng
 
Javascript ajax tutorial
Javascript ajax tutorialJavascript ajax tutorial
Javascript ajax tutorial
Vlad Posea
 
Webinar on Angular JS titled 'Develop Responsive Single Page Application'
Webinar on Angular JS titled 'Develop Responsive Single Page Application'Webinar on Angular JS titled 'Develop Responsive Single Page Application'
Webinar on Angular JS titled 'Develop Responsive Single Page Application'
Edureka!
 
Understanding Javascript AJAX - Imrokraft
Understanding Javascript AJAX - ImrokraftUnderstanding Javascript AJAX - Imrokraft
Understanding Javascript AJAX - Imrokraft
imrokraft
 
Jquery introduction
Jquery introductionJquery introduction
Jquery introduction
musrath mohammad
 
Como ser mejor entrenador coerver
Como ser mejor entrenador coerverComo ser mejor entrenador coerver
Como ser mejor entrenador coerver
Stoyan Lubomirov Kartchev
 
Building Applications Using Ajax
Building Applications Using AjaxBuilding Applications Using Ajax
Building Applications Using Ajax
s_pradeep
 
JSON: The Basics
JSON: The BasicsJSON: The Basics
JSON: The Basics
Jeff Fox
 
Introduction to AJAX In WordPress
Introduction to AJAX In WordPressIntroduction to AJAX In WordPress
Introduction to AJAX In WordPress
Caldera Labs
 
Fourth Dimension Level 1
Fourth Dimension Level 1Fourth Dimension Level 1
Fourth Dimension Level 1
Ehtesham Mirxa
 
MachinePulse Products
MachinePulse ProductsMachinePulse Products
MachinePulse Products
MachinePulse
 
WebApp / SPA @ AllFacebook Developer Conference
WebApp / SPA @ AllFacebook Developer ConferenceWebApp / SPA @ AllFacebook Developer Conference
WebApp / SPA @ AllFacebook Developer Conference
AllFacebook.de
 
Intro to SPA using JavaScript & ASP.NET
Intro to SPA using JavaScript & ASP.NETIntro to SPA using JavaScript & ASP.NET
Intro to SPA using JavaScript & ASP.NET
Alan Hecht
 
Writing SPA in 2017
Writing SPA in 2017Writing SPA in 2017
Writing SPA in 2017
Arek Flinik
 
Ajax by Examples 2
Ajax by Examples 2Ajax by Examples 2
Ajax by Examples 2
Yenwen Feng
 
Javascript ajax tutorial
Javascript ajax tutorialJavascript ajax tutorial
Javascript ajax tutorial
Vlad Posea
 
Webinar on Angular JS titled 'Develop Responsive Single Page Application'
Webinar on Angular JS titled 'Develop Responsive Single Page Application'Webinar on Angular JS titled 'Develop Responsive Single Page Application'
Webinar on Angular JS titled 'Develop Responsive Single Page Application'
Edureka!
 
Understanding Javascript AJAX - Imrokraft
Understanding Javascript AJAX - ImrokraftUnderstanding Javascript AJAX - Imrokraft
Understanding Javascript AJAX - Imrokraft
imrokraft
 
Ad

Similar to An Introduction to Ajax Programming (20)

AJAX-Asynchronous JavaScript and XML
AJAX-Asynchronous JavaScript and XMLAJAX-Asynchronous JavaScript and XML
AJAX-Asynchronous JavaScript and XML
wahidullah mudaser
 
Ajax
AjaxAjax
Ajax
soumya
 
Web Programming using Asynchronous JavaX
Web Programming using Asynchronous JavaXWeb Programming using Asynchronous JavaX
Web Programming using Asynchronous JavaX
SivanN6
 
HSHDGDGDHDYDUDUDUDHDHDHSHAHAHSHSBDHDHDHDHDHD
HSHDGDGDHDYDUDUDUDHDHDHSHAHAHSHSBDHDHDHDHDHDHSHDGDGDHDYDUDUDUDHDHDHSHAHAHSHSBDHDHDHDHDHD
HSHDGDGDHDYDUDUDUDHDHDHSHAHAHSHSBDHDHDHDHDHD
srlegaspi2101
 
Ajax
AjaxAjax
Ajax
Manav Prasad
 
Ajax
AjaxAjax
Ajax
NIRMAL FELIX
 
Ajax
AjaxAjax
Ajax
TSUBHASHRI
 
How to make Ajax work for you
How to make Ajax work for youHow to make Ajax work for you
How to make Ajax work for you
Simon Willison
 
01 Ajax Intro
01 Ajax Intro01 Ajax Intro
01 Ajax Intro
Dennis Pipper
 
Ajax
AjaxAjax
Ajax
Shivam Jaiswal
 
AJAX.pptx
AJAX.pptxAJAX.pptx
AJAX.pptx
Ganesh Chavan
 
Ajax
AjaxAjax
Ajax
baabtra.com - No. 1 supplier of quality freshers
 
Ajax
AjaxAjax
Ajax
husnara mohammad
 
Ajax
AjaxAjax
Ajax
sujaykumar
 
25250716 seminar-on-ajax text
25250716 seminar-on-ajax text25250716 seminar-on-ajax text
25250716 seminar-on-ajax text
Kamleshh Chandnani
 
Ajax tutorial by bally chohan
Ajax tutorial by bally chohanAjax tutorial by bally chohan
Ajax tutorial by bally chohan
WebVineet
 
Java script202
Java script202Java script202
Java script202
Wasiq Zia
 
Ajax
AjaxAjax
Ajax
anandha ganesh
 
orcreatehappyusers
orcreatehappyusersorcreatehappyusers
orcreatehappyusers
tutorialsruby
 
orcreatehappyusers
orcreatehappyusersorcreatehappyusers
orcreatehappyusers
tutorialsruby
 
Ad

More from hchen1 (14)

Semantic Web 2.0
Semantic Web 2.0Semantic Web 2.0
Semantic Web 2.0
hchen1
 
Semantic HTML
Semantic HTMLSemantic HTML
Semantic HTML
hchen1
 
Geonames
GeonamesGeonames
Geonames
hchen1
 
Google Maps API
Google Maps APIGoogle Maps API
Google Maps API
hchen1
 
Geospatial Web
Geospatial WebGeospatial Web
Geospatial Web
hchen1
 
OpenSearch
OpenSearchOpenSearch
OpenSearch
hchen1
 
RSS and Atom in the Social Web
RSS and Atom in the Social WebRSS and Atom in the Social Web
RSS and Atom in the Social Web
hchen1
 
Machine Tags
Machine TagsMachine Tags
Machine Tags
hchen1
 
Web 2.0 Mashups
Web 2.0 MashupsWeb 2.0 Mashups
Web 2.0 Mashups
hchen1
 
Gnizr Architecture (for developers)
Gnizr Architecture (for developers)Gnizr Architecture (for developers)
Gnizr Architecture (for developers)
hchen1
 
Folksonomy and Tagging in the Social Web
Folksonomy and Tagging in the Social WebFolksonomy and Tagging in the Social Web
Folksonomy and Tagging in the Social Web
hchen1
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
hchen1
 
Inside Gnizr
Inside GnizrInside Gnizr
Inside Gnizr
hchen1
 
Social Web Technologies
Social Web TechnologiesSocial Web Technologies
Social Web Technologies
hchen1
 
Semantic Web 2.0
Semantic Web 2.0Semantic Web 2.0
Semantic Web 2.0
hchen1
 
Semantic HTML
Semantic HTMLSemantic HTML
Semantic HTML
hchen1
 
Geonames
GeonamesGeonames
Geonames
hchen1
 
Google Maps API
Google Maps APIGoogle Maps API
Google Maps API
hchen1
 
Geospatial Web
Geospatial WebGeospatial Web
Geospatial Web
hchen1
 
OpenSearch
OpenSearchOpenSearch
OpenSearch
hchen1
 
RSS and Atom in the Social Web
RSS and Atom in the Social WebRSS and Atom in the Social Web
RSS and Atom in the Social Web
hchen1
 
Machine Tags
Machine TagsMachine Tags
Machine Tags
hchen1
 
Web 2.0 Mashups
Web 2.0 MashupsWeb 2.0 Mashups
Web 2.0 Mashups
hchen1
 
Gnizr Architecture (for developers)
Gnizr Architecture (for developers)Gnizr Architecture (for developers)
Gnizr Architecture (for developers)
hchen1
 
Folksonomy and Tagging in the Social Web
Folksonomy and Tagging in the Social WebFolksonomy and Tagging in the Social Web
Folksonomy and Tagging in the Social Web
hchen1
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
hchen1
 
Inside Gnizr
Inside GnizrInside Gnizr
Inside Gnizr
hchen1
 
Social Web Technologies
Social Web TechnologiesSocial Web Technologies
Social Web Technologies
hchen1
 

Recently uploaded (20)

Introducing FME Realize: A New Era of Spatial Computing and AR
Introducing FME Realize: A New Era of Spatial Computing and ARIntroducing FME Realize: A New Era of Spatial Computing and AR
Introducing FME Realize: A New Era of Spatial Computing and AR
Safe Software
 
Jeremy Millul - A Talented Software Developer
Jeremy Millul - A Talented Software DeveloperJeremy Millul - A Talented Software Developer
Jeremy Millul - A Talented Software Developer
Jeremy Millul
 
Nix(OS) for Python Developers - PyCon 25 (Bologna, Italia)
Nix(OS) for Python Developers - PyCon 25 (Bologna, Italia)Nix(OS) for Python Developers - PyCon 25 (Bologna, Italia)
Nix(OS) for Python Developers - PyCon 25 (Bologna, Italia)
Peter Bittner
 
UiPath Community Zurich: Release Management and Build Pipelines
UiPath Community Zurich: Release Management and Build PipelinesUiPath Community Zurich: Release Management and Build Pipelines
UiPath Community Zurich: Release Management and Build Pipelines
UiPathCommunity
 
Dev Dives: System-to-system integration with UiPath API Workflows
Dev Dives: System-to-system integration with UiPath API WorkflowsDev Dives: System-to-system integration with UiPath API Workflows
Dev Dives: System-to-system integration with UiPath API Workflows
UiPathCommunity
 
Securiport - A Border Security Company
Securiport  -  A Border Security CompanySecuriport  -  A Border Security Company
Securiport - A Border Security Company
Securiport
 
Microsoft Build 2025 takeaways in one presentation
Microsoft Build 2025 takeaways in one presentationMicrosoft Build 2025 takeaways in one presentation
Microsoft Build 2025 takeaways in one presentation
Digitalmara
 
Cognitive Chasms - A Typology of GenAI Failure Failure Modes
Cognitive Chasms - A Typology of GenAI Failure Failure ModesCognitive Chasms - A Typology of GenAI Failure Failure Modes
Cognitive Chasms - A Typology of GenAI Failure Failure Modes
Dr. Tathagat Varma
 
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
Jasper Oosterveld
 
End-to-end Assurance for SD-WAN & SASE with ThousandEyes
End-to-end Assurance for SD-WAN & SASE with ThousandEyesEnd-to-end Assurance for SD-WAN & SASE with ThousandEyes
End-to-end Assurance for SD-WAN & SASE with ThousandEyes
ThousandEyes
 
The case for on-premises AI
The case for on-premises AIThe case for on-premises AI
The case for on-premises AI
Principled Technologies
 
Kubernetes Cloud Native Indonesia Meetup - May 2025
Kubernetes Cloud Native Indonesia Meetup - May 2025Kubernetes Cloud Native Indonesia Meetup - May 2025
Kubernetes Cloud Native Indonesia Meetup - May 2025
Prasta Maha
 
Dr Jimmy Schwarzkopf presentation on the SUMMIT 2025 A
Dr Jimmy Schwarzkopf presentation on the SUMMIT 2025 ADr Jimmy Schwarzkopf presentation on the SUMMIT 2025 A
Dr Jimmy Schwarzkopf presentation on the SUMMIT 2025 A
Dr. Jimmy Schwarzkopf
 
Maxx nft market place new generation nft marketing place
Maxx nft market place new generation nft marketing placeMaxx nft market place new generation nft marketing place
Maxx nft market place new generation nft marketing place
usersalmanrazdelhi
 
GDG Cloud Southlake #43: Tommy Todd: The Quantum Apocalypse: A Looming Threat...
GDG Cloud Southlake #43: Tommy Todd: The Quantum Apocalypse: A Looming Threat...GDG Cloud Southlake #43: Tommy Todd: The Quantum Apocalypse: A Looming Threat...
GDG Cloud Southlake #43: Tommy Todd: The Quantum Apocalypse: A Looming Threat...
James Anderson
 
LSNIF: Locally-Subdivided Neural Intersection Function
LSNIF: Locally-Subdivided Neural Intersection FunctionLSNIF: Locally-Subdivided Neural Intersection Function
LSNIF: Locally-Subdivided Neural Intersection Function
Takahiro Harada
 
Let’s Get Slack Certified! 🚀- Slack Community
Let’s Get Slack Certified! 🚀- Slack CommunityLet’s Get Slack Certified! 🚀- Slack Community
Let’s Get Slack Certified! 🚀- Slack Community
SanjeetMishra29
 
Introducing the OSA 3200 SP and OSA 3250 ePRC
Introducing the OSA 3200 SP and OSA 3250 ePRCIntroducing the OSA 3200 SP and OSA 3250 ePRC
Introducing the OSA 3200 SP and OSA 3250 ePRC
Adtran
 
Agentic AI Explained: The Next Frontier of Autonomous Intelligence & Generati...
Agentic AI Explained: The Next Frontier of Autonomous Intelligence & Generati...Agentic AI Explained: The Next Frontier of Autonomous Intelligence & Generati...
Agentic AI Explained: The Next Frontier of Autonomous Intelligence & Generati...
Aaryan Kansari
 
AI Emotional Actors: “When Machines Learn to Feel and Perform"
AI Emotional Actors:  “When Machines Learn to Feel and Perform"AI Emotional Actors:  “When Machines Learn to Feel and Perform"
AI Emotional Actors: “When Machines Learn to Feel and Perform"
AkashKumar809858
 
Introducing FME Realize: A New Era of Spatial Computing and AR
Introducing FME Realize: A New Era of Spatial Computing and ARIntroducing FME Realize: A New Era of Spatial Computing and AR
Introducing FME Realize: A New Era of Spatial Computing and AR
Safe Software
 
Jeremy Millul - A Talented Software Developer
Jeremy Millul - A Talented Software DeveloperJeremy Millul - A Talented Software Developer
Jeremy Millul - A Talented Software Developer
Jeremy Millul
 
Nix(OS) for Python Developers - PyCon 25 (Bologna, Italia)
Nix(OS) for Python Developers - PyCon 25 (Bologna, Italia)Nix(OS) for Python Developers - PyCon 25 (Bologna, Italia)
Nix(OS) for Python Developers - PyCon 25 (Bologna, Italia)
Peter Bittner
 
UiPath Community Zurich: Release Management and Build Pipelines
UiPath Community Zurich: Release Management and Build PipelinesUiPath Community Zurich: Release Management and Build Pipelines
UiPath Community Zurich: Release Management and Build Pipelines
UiPathCommunity
 
Dev Dives: System-to-system integration with UiPath API Workflows
Dev Dives: System-to-system integration with UiPath API WorkflowsDev Dives: System-to-system integration with UiPath API Workflows
Dev Dives: System-to-system integration with UiPath API Workflows
UiPathCommunity
 
Securiport - A Border Security Company
Securiport  -  A Border Security CompanySecuriport  -  A Border Security Company
Securiport - A Border Security Company
Securiport
 
Microsoft Build 2025 takeaways in one presentation
Microsoft Build 2025 takeaways in one presentationMicrosoft Build 2025 takeaways in one presentation
Microsoft Build 2025 takeaways in one presentation
Digitalmara
 
Cognitive Chasms - A Typology of GenAI Failure Failure Modes
Cognitive Chasms - A Typology of GenAI Failure Failure ModesCognitive Chasms - A Typology of GenAI Failure Failure Modes
Cognitive Chasms - A Typology of GenAI Failure Failure Modes
Dr. Tathagat Varma
 
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
Jasper Oosterveld
 
End-to-end Assurance for SD-WAN & SASE with ThousandEyes
End-to-end Assurance for SD-WAN & SASE with ThousandEyesEnd-to-end Assurance for SD-WAN & SASE with ThousandEyes
End-to-end Assurance for SD-WAN & SASE with ThousandEyes
ThousandEyes
 
Kubernetes Cloud Native Indonesia Meetup - May 2025
Kubernetes Cloud Native Indonesia Meetup - May 2025Kubernetes Cloud Native Indonesia Meetup - May 2025
Kubernetes Cloud Native Indonesia Meetup - May 2025
Prasta Maha
 
Dr Jimmy Schwarzkopf presentation on the SUMMIT 2025 A
Dr Jimmy Schwarzkopf presentation on the SUMMIT 2025 ADr Jimmy Schwarzkopf presentation on the SUMMIT 2025 A
Dr Jimmy Schwarzkopf presentation on the SUMMIT 2025 A
Dr. Jimmy Schwarzkopf
 
Maxx nft market place new generation nft marketing place
Maxx nft market place new generation nft marketing placeMaxx nft market place new generation nft marketing place
Maxx nft market place new generation nft marketing place
usersalmanrazdelhi
 
GDG Cloud Southlake #43: Tommy Todd: The Quantum Apocalypse: A Looming Threat...
GDG Cloud Southlake #43: Tommy Todd: The Quantum Apocalypse: A Looming Threat...GDG Cloud Southlake #43: Tommy Todd: The Quantum Apocalypse: A Looming Threat...
GDG Cloud Southlake #43: Tommy Todd: The Quantum Apocalypse: A Looming Threat...
James Anderson
 
LSNIF: Locally-Subdivided Neural Intersection Function
LSNIF: Locally-Subdivided Neural Intersection FunctionLSNIF: Locally-Subdivided Neural Intersection Function
LSNIF: Locally-Subdivided Neural Intersection Function
Takahiro Harada
 
Let’s Get Slack Certified! 🚀- Slack Community
Let’s Get Slack Certified! 🚀- Slack CommunityLet’s Get Slack Certified! 🚀- Slack Community
Let’s Get Slack Certified! 🚀- Slack Community
SanjeetMishra29
 
Introducing the OSA 3200 SP and OSA 3250 ePRC
Introducing the OSA 3200 SP and OSA 3250 ePRCIntroducing the OSA 3200 SP and OSA 3250 ePRC
Introducing the OSA 3200 SP and OSA 3250 ePRC
Adtran
 
Agentic AI Explained: The Next Frontier of Autonomous Intelligence & Generati...
Agentic AI Explained: The Next Frontier of Autonomous Intelligence & Generati...Agentic AI Explained: The Next Frontier of Autonomous Intelligence & Generati...
Agentic AI Explained: The Next Frontier of Autonomous Intelligence & Generati...
Aaryan Kansari
 
AI Emotional Actors: “When Machines Learn to Feel and Perform"
AI Emotional Actors:  “When Machines Learn to Feel and Perform"AI Emotional Actors:  “When Machines Learn to Feel and Perform"
AI Emotional Actors: “When Machines Learn to Feel and Perform"
AkashKumar809858
 

An Introduction to Ajax Programming

  • 1. An Introduction to Ajax Programming Dr. Harry Chen CMSC 491S/691S March 5, 2008
  • 2. Agenda What’s Ajax? (revisit) JavaScript in 10 minutes DOM and XMLHttpRequest Programming Ajax with Mochikit Ajax Pitfalls Ajax in gnizr
  • 3. Ajax A synchronous J avaScript A nd X ML The idea is to enable interactive Web pages without requiring the browser to refresh. Browser JavaScript code Web Server “ Give me some data” “ Here, data” Modify the page content, without refreshing the page
  • 4. Ajax vs. tradition HTTP paradigm In the tradition HTTP world Every request results in a new page loading Dynamic pages are created on the server-side Data, format and styling are done on the server In the Ajax world The result of an Ajax call may only change a small parts of an existing HTML page Server sets up the page structure, JavaScript code performs the content creation Data, format and styling are done via JavaScript (CSS and XHTML)
  • 5. Ajax is a 3-Legged Stool XHTML JavaScript CSS Ajax Adopted from Simon Wilson: http://www.slideshare.net/simon/how-to-make-ajax-work-for-you
  • 6. JavaScript in 10 minutes Examples adopted from http://www.w3schools.com/js/js_examples.asp
  • 7. Say “hello world” What’s ‘document’?
  • 8. Write into HTML <body/> ‘ document ’ is a predefined JavaScript variable that represents the entire HTML document. You can read from and write to the current document via this ‘ document ’ variable.
  • 9. Loading JavaScript code Two ways to load your JS code Inline within the same HTML document From a separate file on the server e.g., Replace ‘xxx.js’ with http://path/to/myprogram.js
  • 11. Define Array and Associative Array
  • 13. Assign Function to a Variable In JavaScript, you can assign function to a variable.
  • 14. Additional Resource JavaScript Tutorial http://www.w3schools.com/js/ PPK on JavaScript http://www.quirksmode.org/ I love it!
  • 16. DOM Document Object Model All XHTML doc are XML doc DOM is a process-model for XML For reading and writing XML doc We can use DOM to manipulate XHTML
  • 18. An XML DOM (not XHTML) <bookstore> <book category=“c1”> <title lang=“en”>Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price> </book> </bookstore>
  • 19. HTML DOM Tree – an example
  • 20. JavaScript DOM Browser’s JS engines provides predefine HTML DOM objects
  • 21. ‘Document’ DOM Predefined objects come with predefined properties and methods http://www.w3schools.com/htmldom/dom_obj_document.asp Watch out for browser support!
  • 22. DOM Manipulation Operations for manipulating DOM objects are similar in different programming langauges – e.g., Java, PHP and JavaScript. Tutorial http://www.w3schools.com/dom/default.asp
  • 23. XMLHttpRequest Is a specification (see W3C doc) Defines an API that provides scripted client functionality for transferring data between a client and a server Browser JavaScript code Web Server “ Give me some data” “ Here, data.” Modify the page content, without refreshing the page Done via XMLHttpRequest
  • 24. Clarification Use XMLHttpRequest to send and receive data from servers via HTTP Data sent and received can be any text format, not just XML. Works over HTTP and HTTPS http://www.w3.org/TR/XMLHttpRequest/
  • 25. Fetch XML Data from the Server http://www.w3.org/TR/XMLHttpRequest/
  • 26. Send data using XMLHttpRequest http://www.w3.org/TR/XMLHttpRequest/
  • 27. Common Problems with DOM and XMLHttpRequest
  • 28. XMLHttpRequest Cross-browser Issues Most browsers support the standard implementation, but some provide extra support that others don’t. Firefox implements standard and more IE implements just the standard
  • 29. XMLHttpRequest Creation Creating an XMLHttpRequest object is done differently depending on the browser. Checks which browser the client is using! Crazy!
  • 30. DOM Cross-browser issues DOM API differs from browser to brower. Remember this chart?
  • 31. Get Node Value – FF vs. IE
  • 32. Additional Reading AJAX - Common Pitfalls http://grover.open2space.com/node/92
  • 34. JavaScript Libraries To make JavaScript developer more productive, many JS libraries have been created. MochiKit  I prefer; light-weight and simple jQuery Yahoo! UI library Prototype Script.aculo.us
  • 35. MochiKit A collection API that simplify JavaScript programming “Makes JavaScript suck a bit less” http://www.mochikit.com
  • 36. Load MochiKit All API can be loaded from a single file <script type=&quot;text/javascript&quot; src=&quot;MochiKit.js&quot;></script> 
  • 37. What does MochiKit provide? Ajax programmers look here!
  • 38. Fetch JSON Data from the Server The location of the data. Instantiate a function for making the call. Define how we want to handle the “response”. Actually makes the call.
  • 39. What we didn’t do! We didn’t have to create the XMLHttpRequest object ourselves. Don’t have to worry about those cross-browser issues. We don’t have to deal with HTTP methods -- “PUT”, “GET” etc.
  • 40. Additional Reading Reading MochiKit’s doc for How to manipulate DOM How to change CSS style How to deal with asynchronous events How to enable Drag and Drop How to exploit JavaScript functional and OO programming
  • 42. Ajax Programming Issues Breaking the back button Not giving immediate visual cues for clicking widgets “Did I click?”, “I thought I have clicked”
  • 43. Data loading issues Loading… Please wait… (after 3 secs) I’m still loading. Please wait… (after 5 secs) I’m still loading. Please wait.. (after 30 secs) User: forget you. I’m leaving.
  • 44. JavaScript Code Loading Issue Too much JavaScript code can slow down the performance the client browser. Only use JavaScript and Ajax when it is necessary. More code != Better program
  • 45. Search Crawler Issue Text content rendered by JavaScript is not accessible to search crawler. Empty page?
  • 46. Accessibility Not all screenreaders are built to work with Ajax applications. http://www.sitepoint.com/article/ajax-screenreaders-work
  • 47. Summary Ajax programming can make Web pages to be more interactive and responsive. XHTML, CSS and JavaScript are the key components Ajax Ajax uses XMLHttpRequest object to send and receive data Study Ajax Pitfalls can help you to build more effective Mashup and Web 2.0 apps.