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.

 

Homework:

Review: W3schools AJAX Webpages

Create: and Link to Homework page!

Topics Covered:

AJAX Information

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

W3schools XMLXSLAJAX

You have three parts

An XMLHttpRequest Object

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

A Request

xmlhttp.open(method,url,async); example xmlhttp.open("GET","ajax.xml",true);
xmlhttp.send();

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

Terms:

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

Well formed

Wikipedia AJAX

AJAX HTML Controls

Homework:

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

Final Step:

Review in your mind everything we covered in class and remember to cover it again before you go to bed so your mind to process this information while you sleep.