Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading out of date XML doc 1

Status
Not open for further replies.

Trebor100

Programmer
Mar 14, 2006
90
GB
Hi,

I've got a problem with reading up to date XML. The following code works fine in loading my XML up. However if the XML is changed and the page refreshed it recalls these functions correctly but still uses the out of date XML prior to the alterations. Any help would be much appriciated.

function AdminCourseLoadDropDown()
{
url = CourseURL;
xmlhttp2=null;
if (window.XMLHttpRequest)
{
xmlhttp2=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP")
}
if (xmlhttp2!=null)
{
xmlhttp2.onreadystatechange=state_Change_Course
xmlhttp2.open("GET",url,true)
xmlhttp2.send(null)
}
else
{
alert("Your browser does not support XMLHTTP.")
}
}

function state_Change_Course()
{
if (xmlhttp2.readyState==4)
{
if (xmlhttp2.status==200)
{
var response = xmlhttp2.responseXML.documentElement;
var x=response.getElementsByTagName("ENTRY")
var prev = "";
var txt = "";
var lock = "";
for(i=0;i<x.length;i++)
{
prev = txt;
try
{
xx = x.getElementsByTagName("LOCK");
lock = xx[0].firstChild.data;
xx = x.getElementsByTagName("CATEGORY");
category = xx[0].firstChild.data;
match = document.getElementById('admincourseamendcategoryselect').value;

if (lock != "1" && match == category)
{
xx=x.getElementsByTagName("ID");
txt = txt + "<option value='" + xx[0].firstChild.data + "'>";

xx=x.getElementsByTagName("COURSE_NAME");
txt = txt + xx[0].firstChild.data + "</option>";
}
}
catch(ex)
{
txt = prev
}
}
strOption = txt;
buildCategoryDropDown("admincourseamendcourse","admincourseamendcourseselect","");
}
else
{
alert("Problem retrieving XML data:" + xmlhttp2.statusText);
}
}
}
 
>url = CourseURL;
Vary it to make it unique every time by adding a dummy.
[tt]url = CourseURL
url+="?x="+Math.floor(Math.random()*10000);[/tt]
 
cheers tsuji - saved my bacon!

its one of those solutions where u think why didnt i think of that :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top