ajax_lecture2 - Rapid Application Web Development Lecture...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
Rapid Application Web Development Fall 2006 Dr. McDaniel Lecture 2: Using XML with AJAX
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Announcements Programming assignment 1 must be turned in by 11:55PM tonight. Normal office hours today from 3:00- 5:00. Programming assignment 2 has been posted to WebCT.
Background image of page 2
XML The e X tensible M arkup L anguage, or XML, is a key component of Web 2.0 technologies A primary advantage is that it gives us the power to attach semantic meaning to units of information The XHR (XmlHttpRequest) object/API has a property, responseXML , which will return a server response as XML. Why not just return all server data using the responseText property?
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Example of an XML File (W3schools) Note that each “food” unit is encapsulated within a higher order “breakfast_menu” unit. We can save this file as food.xml .
Background image of page 4
Accessing this data in Ajax Let’s create a simple application which will allow us to retrieve some food information from an XML file and display it on an HTML page. We’ll need to create the following files: index.html food.xml include.js Let’s see how these three files will communicate.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
index.html
Background image of page 6
include.js (part 1) First, we see the same functions that we have used previously to work with the XHR object/API.
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
include.js (part 2) Next, we see the StartAjax() function which will create our XHR object and load the XML file.
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 34

ajax_lecture2 - Rapid Application Web Development Lecture...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online