HTML and CSS Reference
In-Depth Information
The XML File (bookstore.xml)
EXAMPLE 18.10
<bookstore>
<book category="COOKING">
<title>The Art of Simple Food</title>
<author>Alice Waters</author>
<published>2007</published>
<price>35.00</price>
</book>
<book category="AUTOBIOGRAPHY">
<title>Moments of Being</title>
<author>Virginia Woolf</author>
<published>1985</published>
<price>14.00</price>
</book>
<book category="FICTION">
<title>Plain Truth</title>
<author>Judy Picoult</author>
<published>2000</published>
<price>15.00</price>
</book>
</bookstore>
Ajax Program
EXAMPLE 18.11
<html>
<head><title>Reading from an XML file</title>
<script type="text/javascript" src="ajaxCreateRequest.js">
</script>
<script type="text/javascript">
1
function makeRequest(url){
var httpRequest=createRequest() ; * Cross-browser check;
Get a new XMLHttpRequest object */
if( httpRequest != false){ // If we got back a request
// object
httpRequest.open('GET', url, true);
httpRequest.setRequestHeader('If-Modified-Since',
'Sat, 03 Jan 2010 00:00:00GMT');
httpRequest.send(null);
httpRequest.onreadystatechange = function() {
2
getXMLContents(httpRequest) ;};
}
else{ alert("There was a problem with your request.");}
}// End createRequest function
Continues
Search WWH ::




Custom Search