Class Note 15 for Web Scripting 

Learning Objectives:

You will be able to create an XML Document

You will be able to create a document that uses AJAX to fill in part of the content.



Review: W3schools AJAX Webpages

Create: and Link to Homework page!

Topics Covered:

AJAX Information

AJAX is the marriage between JavaScriptCSS (or XSL) and XML


You have three parts

An XMLHttpRequest Object

var xmlhttp;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

A Request,url,async); example"GET","ajax.xml",true);

A Response

responseText get the response data as a string
responseXML get the response data as XML data


My XML File and using AJAX. Fill in the State using AJAX


XML Information

Well formed XML (XML that follows the rules)

You need to declare you are using XML
   <?xml version="1.0" encoding="ISO-8859-1"?> 

XML documents must have a root element
   (A container Element that appears only once that encapsulates all of the XML Elements) 

XML elements must have a closing tag 

XML elements names 
   can not start with a number or punctuation mark 
   can not contain spaces
   can not start with the letters xml

XML tags are case sensitive 

XML elements must be properly nested 

XML attribute values must use quotes


XML (eXtensible Markup Language), DTD (Document Type Definition) , SchemaXSL (XML Style Language)

Well formed

Wikipedia AJAX

AJAX HTML Controls


Reminder: Post your articles on Canvas under the Weekly Articles on the Discussion Board Section.

HTML Valid