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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable not updating in realtime

Status
Not open for further replies.

mcpeekj

Vendor
Sep 21, 2001
105
Let me preface this by saying I don't know anything about XML (or not much, anyway).
I have an ASP page that I want to check the modified date of a file every 10 seconds and if it has changed, to refresh the page. Somebody in the ASP forum suggested I use some XML, which I have put below. The problem is that when the modified date has changed when the page is open, the variable isn't updating, it's retaining the initial modified date from when the page was loaded. Can anybody help?

page1
function AskServer() {
var START_TIME = '<%= cStr(Now())%>';
var oXML = new ActiveXObject("Microsoft.XMLHTTP");
var sTime;
oXML.open("GET", "Page2.asp", false);
oXML.send();
sTime = oXML.responseText

if (sTime > START_TIME)
{
alert('Reloading!\n' + sTime);
window.location = "team.asp";
return;
}

alert('Staying here.\n' + sTime);
sTime = '';
setTimeout("AskServer();", 5000)
return;
}

setTimeout("AskServer();", 5000)

page2

<%@ Language=VBScript %>
<%
dim fs, f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile(Server.MapPath("status.mdb"))
LastModified = f.datelastmodified
response.write LastModified
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top