Hi all,
Trying my hand and javascript but I am unable to get the xmlhttprequest object to work properly. The code im using is as follows and the XML is included at the bottom of this message. Any help (even if it's "your an idiot add ..." level) would be much appreciated
<html>
<head>
<script type="text/javascript">
var req;
function loadXMLDoc(url)
{
// 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();
}
}
}
function processReqChange()
{
// only if req shows "complete"
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
alert("wahoo");
} else {
alert("There was a problem retrieving the XML data:\n" + req.statusText);
}
}
}
</script>
</head>
<body onload="loadXMLDoc('\TUTOR\XML\subset.xml')">
<h2>Using the HttpRequest Object</h2>
</body>
</html>
and the XML
<?xml version="1.0" encoding="ISO-8859-1" ?>
<SUBSET>
<ENTRY>
<REF>1</REF>
<TITLE>Global Course</TITLE>
</ENTRY>
<ENTRY>
<REF>2</REF>
<TITLE>Seminars</TITLE>
</ENTRY>
<ENTRY>
<REF>3</REF>
<TITLE>Conference</TITLE>
</ENTRY>
<ENTRY>
<REF>4</REF>
<TITLE>ICT</TITLE>
</ENTRY>
<ENTRY>
<REF>5</REF>
<TITLE>HR And Payroll</TITLE>
</ENTRY>
<ENTRY>
<REF>6</REF>
<TITLE>2010</TITLE>
</ENTRY>
</SUBSET>
Cheers all,
Rob
Trying my hand and javascript but I am unable to get the xmlhttprequest object to work properly. The code im using is as follows and the XML is included at the bottom of this message. Any help (even if it's "your an idiot add ..." level) would be much appreciated

<html>
<head>
<script type="text/javascript">
var req;
function loadXMLDoc(url)
{
// 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();
}
}
}
function processReqChange()
{
// only if req shows "complete"
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
alert("wahoo");
} else {
alert("There was a problem retrieving the XML data:\n" + req.statusText);
}
}
}
</script>
</head>
<body onload="loadXMLDoc('\TUTOR\XML\subset.xml')">
<h2>Using the HttpRequest Object</h2>
</body>
</html>
and the XML
<?xml version="1.0" encoding="ISO-8859-1" ?>
<SUBSET>
<ENTRY>
<REF>1</REF>
<TITLE>Global Course</TITLE>
</ENTRY>
<ENTRY>
<REF>2</REF>
<TITLE>Seminars</TITLE>
</ENTRY>
<ENTRY>
<REF>3</REF>
<TITLE>Conference</TITLE>
</ENTRY>
<ENTRY>
<REF>4</REF>
<TITLE>ICT</TITLE>
</ENTRY>
<ENTRY>
<REF>5</REF>
<TITLE>HR And Payroll</TITLE>
</ENTRY>
<ENTRY>
<REF>6</REF>
<TITLE>2010</TITLE>
</ENTRY>
</SUBSET>
Cheers all,
Rob