Top Banner
AJAX: AJAX: Asynchronous JavaScript Asynchronous JavaScript and XML and XML By: Alex Maskovyak & Young Suk Moon 4005-713 ` XML Architecture, Tools & Techniques ` 01/14/2009
18
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 4005-713 ` XML Architecture, Tools & Technique ` Presentation

AJAX: AJAX: Asynchronous JavaScript Asynchronous JavaScript and XMLand XMLBy: Alex Maskovyak & Young Suk Moon

4005-713 ` XML Architecture, Tools & Techniques ` 01/14/2009

Page 2: 4005-713 ` XML Architecture, Tools & Technique ` Presentation

OutlineOutlineOverview

◦ExamplesBackground

◦Web Application Model◦Problems◦Other alternatives

TechnologyDemoWeb PresenceSourcesQuestions

Page 3: 4005-713 ` XML Architecture, Tools & Technique ` Presentation

OverviewOverviewGroup of web development

techniques/technologiesUsed to create interactive “web

applications”Technical jargonBackbone behind “web 2.0”

Page 4: 4005-713 ` XML Architecture, Tools & Technique ` Presentation

Overview: ExamplesOverview: ExamplesGoogle suggest: dynamic search

suggestionsGoogle Gmail: rich interface for

emailGoogle maps : interactive atlasDel.icio.us : social bookmarkingFacebook : social gathering site

Page 5: 4005-713 ` XML Architecture, Tools & Technique ` Presentation

Background: Web Application Background: Web Application ModelModelRequest/response

communication mode◦User (through browser) requests

information◦Browser waits for server response◦Server responds with information◦Browser refreshes the page

Page 6: 4005-713 ` XML Architecture, Tools & Technique ` Presentation

Background: ProblemsBackground: ProblemsUnfriendly user experienceSlowBandwidth/server intensive

Page 7: 4005-713 ` XML Architecture, Tools & Technique ` Presentation

AlternativesAlternativesLoad everything on page load and

display only what is needed/when it is needed (hide everything else)◦Good

improves user experience reduces server requests/loads

◦Bad does not solve total bandwidth server

problems resource wasteful on the local machine

Page 8: 4005-713 ` XML Architecture, Tools & Technique ` Presentation

Alternatives Alternatives Java applets

◦Good interactive web applications reduces server requests/loads

◦Bad large and slow to load requires browser plugin and compatible

JVM breaks web page continuity (look and feel

may differ from page)

Page 9: 4005-713 ` XML Architecture, Tools & Technique ` Presentation

AlternativesAlternativesFlash applets

◦Good highly interactive web applications reduces server requests/load

◦Bad slow to load requires browser plugin Flash development tools aren’t free

Page 10: 4005-713 ` XML Architecture, Tools & Technique ` Presentation

AlternativesAlternativesAJAX…

Page 11: 4005-713 ` XML Architecture, Tools & Technique ` Presentation

AJAX TechnologyAJAX TechnologyAsynchronous JavaScript and XML?General ingredients:

◦Any client-side scripting language (JavaScript, VBScript)

◦Any type of information container (XML, JSON, pre-formatted HTML, plain text)

◦Asynchronous transfer mechanism (Javascript’s XMLHttpRequest)

◦Server side scripting (PHP, ASP, JSP)

Page 12: 4005-713 ` XML Architecture, Tools & Technique ` Presentation

AJAX Technology AJAX Technology (XMLHttpRequest)(XMLHttpRequest)JavaScript classCreated by Microsoft, adapted by other

browsers, and became a standard

var xmlHttp = new XMLHttpRequest();xmlHttp.open(“GET”, “someURL”,

true);xmlHttp.send(“somedata”);xmlHttp.onreadystatechange =

someFunction;

Page 13: 4005-713 ` XML Architecture, Tools & Technique ` Presentation

XMLXMLvar xmldoc =

xmlHttp.responseXML.documentElement;

Organized structured data provides an excellent medium for information exchange

DOM and DOM events can be leveraged

XSLT can be leveraged

Page 14: 4005-713 ` XML Architecture, Tools & Technique ` Presentation

AJAX AdvantagesAJAX AdvantagesMore responsive and interactive pages

◦Browser responds quickly to additional user commands since it doesn’t hang on server response

Reduces bandwidth◦Common content across pages stays the

same◦Only updated content need be requested

Reduces server connections◦Many object will only be requested once

(scripts, stylesheets, etc)Compatible with many browsers

◦No plugins required

Page 15: 4005-713 ` XML Architecture, Tools & Technique ` Presentation

AJAX DisadvantagesAJAX DisadvantagesCreating XMLHttpRequest objects

differs by browserBrowser back/forward buttons

not usefulBookmarking can be difficultSearch engine indexing is difficultBrowser must support JavaScript

and it must be enabledLack of standards, tools, and best

practices

Page 16: 4005-713 ` XML Architecture, Tools & Technique ` Presentation

DemoDemoPresent web-site demonstration.

Page 17: 4005-713 ` XML Architecture, Tools & Technique ` Presentation

Web PresenceWeb PresenceLink:

http://www.cs.rit.edu/~yxm9371/713/ajax.html

Page 18: 4005-713 ` XML Architecture, Tools & Technique ` Presentation

SourcesSourceshttp://www.w3schools.com/Ajax/

default.asphttp://en.wikipedia.org/wiki/

Ajax_(programming)http://www.ajaxf1.com/tutorial/ajax-

php.htmlhttp://www.ajaxmatters.com/http://dot1ne.com/journal/ajax-vs-flash-

round-2-arena-web20-fight