INNOV-2: Build a Better Web Interface Using AJAX - PowerPoint PPT Presentation

About This Presentation
Title:

INNOV-2: Build a Better Web Interface Using AJAX

Description:

XMLHttpRequest Browser Support. Firefox. Safari. Netscape. Opera. Mozilla. 14 ... Cross-Browser http request script // branch for native XMLHttpRequest object ... – PowerPoint PPT presentation

Number of Views:36
Avg rating:3.0/5.0
Slides: 27
Provided by: christophe294
Category:

less

Transcript and Presenter's Notes

Title: INNOV-2: Build a Better Web Interface Using AJAX


1
INNOV-2 Build a Better Web Interface Using AJAX
  • Chris Morgan
  • Pandora Software Systems
  • ChrisMorgan_at_pandora-sys.com

2
Session Goals
  • Define and Explain AJAX
  • Demonstrate the benefits of AJAX in web
    interfaces
  • Provide basic tools for adding AJAX to web
    interfaces
  • Provide examples of AJAX web interfaces

3
Advantages of Web Interfaces
  • Thin Client
  • Easy Deployment
  • OS Independence

4
Disadvantages of Web Interfaces
JavaScript / DHTML
  • User Interface is not as rich
  • Web pages dont interact with databases

AJAX
5
What is AJAX?
  • AJAX (Asynchronous JavaScript And XML) is an
    emerging methodology for adding interactivity
    between a web page and a server-side process.
  • AJAX is not a new technology, it is a method of
    using several existing technologies together,
    including
  • HTML/XHTML
  • CSS
  • JavaScript
  • DOM
  • XML

6
Typical Web Application Architecture
7
Typical Web Application Architecture
Client
User Interface


Time
Server
8
AJAX Application Architecture
9
AJAX Application Architecture
Client
User Interface


AJAX Engine


Server
10
Demo
11
Anatomy of an AJAX Engine
1
http request
2
XML
3
12
JavaScript XMLHttpRequest Object
ltscriptgt req new XMLHttpRequest() req.onreadyst
atechange processReqChange req.open("GET",
url, true) req.send(null) lt/scriptgt
13
XMLHttpRequest Browser Support
  • Firefox
  • Safari
  • Netscape
  • Opera
  • Mozilla

14
What about Microsoft?
Microsoft Internet Explorer still has a 85
market share
As of Feb 2006
15
Microsofts XMLHTTP ActiveX Object
ltscriptgt req new ActiveXObject("Microsoft.XMLHTT
P") if (req) req.onreadystatechange
processReqChange req.open("GET", url,
true) req.send() lt/scriptgt
16
Cross-Browser http request script
// branch for native XMLHttpRequest object if
(window.XMLHttpRequest) req new
XMLHttpRequest() req.onreadystatechange
processReqChange req.open("GET", url,
true) req.send(null) // branch for
IE/Windows ActiveX version else if
(window.ActiveXObject) req new
ActiveXObject("Microsoft.XMLHTTP") if (req)
req.onreadystatechange
processReqChange req.open("GET", url,
true) req.send()
17
A simple processReqChange script
function processReqChange() // only if req
shows complete if (req.readyState 4)
// only if OK if (req.status 200
req.status 0) xmlResponse
req.responseXML.documentElement
if (xmlResponse.tagName
'something') runSomething(xmlResp
onse) else alert('There
was a problem retrieving'
'the XML data '
req.statusText)
// processReqChange()
18
Putting it all Together A Threadsafe AJAX
Engine
function ajaxRequest(url) function
processReqChange() var req null
// prevent browser caching... url
((url.indexOf('?') gt -1) ? '' '?')
'ajaxid' new Date().valueOf() // branch
for native XMLHttpRequest object if
(window.XMLHttpRequest) // branch
for IE/Windows ActiveX version else if
(window.ActiveXObject) //
ajaxRequest( url )
19
Demo
20
AJAX Examples on the Internet
  • Googles gmail interface
  • Google Suggest
  • Yahoo! maps

21
Pros and Cons of AJAX Interfaces
  • Adds Interactivity
  • Portability
  • Easy to implement
  • Many resources available
  • Buzzword compliance
  • Increased server load
  • Need some JavaScript knowledge
  • Requires JavaScript or ActiveX

22
Summary
  • AJAX is an emerging methodology for adding
    interactivity between web pages and databases
  • AJAX is not difficult to implement!
  • AJAX Enabled web interfaces are the future of web
    applications

23
More Resources
  • Exchange
  • INNOV-16 Rich User Interface for the Web????
    AJAX to the Rescue (Ken Wilner) Wednesday,
    115pm
  • Exploring User Interfaces BOF Tuesday, 215pm
  • Print
  • Manning Ajax In Action
  • OReilly JavaScript The Definitive Guide

24
More Resources
  • Internet
  • http//www.adaptivepath.com/publications/essays/ar
    chives/000385.php
  • http//www.xml.com/
  • http//www.ajaxian.com/
  • http//script.aculo.us/
  • http//openrico.org/
  • http//www.openarchitect.com/pjx/pjax.html

25
Questions?
26
Thank you !
http//www.pandora-sys.com/innov-2/
Write a Comment
User Comments (0)
About PowerShow.com