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

html call to vbscript on the server

Status
Not open for further replies.

jgraves13

Programmer
Jan 31, 2007
42
0
0
US
Is it possible to put a vbscript calling the year on a server, then making a call from some html file to get the date from the server?

JG
 
I think I need to refine this, I am looking for a way to execute the date function from the server then apply the time value to some html file. Is this possible for vbscript to take the time from the server and apply it or will the browser always call the clients time???

JG
 
Just make an sync xmlhttp request to a dedicated page on the server and get the response from it.

[1] On the client-side, make a handler
[tt]
function doit
surl="dedicated-page.asp"
set xmlhttp=createobject("msxml2.xmlhttp")
with xmlhttp
.open "get",surl & "?x=" & int(rnd*10000),false
.send
end with
if xmlhttp.status=200 then
sdata=xmlhttp.responsetext
else
sdata=""
end if
set xmlhttp=nothing

'you can now display sdata to some dedicated place on the page which contains the server date
'such as
'document.getElementById("xyz").value=sdata
'and you may need some formatting to make sdata presentable

end function
[/tt]
[2] And the dedicated-page.asp can be as simple as one liner.
<%
response.write now
%>

[3] You have to refine the above as it is air code. Furthermore, the error would be the time for transmitting the response.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top