R
Ruso
I am using ASP to make an application. What I want right now - is to
make the self updating list of the users online - based on thier
cookies. In my opinion all seems to be writen well with it's logic, but
computer thinks otherwise. I use application("loged") to store the
cookies of all users.
Here is a code:
main.asp
<%
if len(request.Cookies("name"))=0 then
Randomize
qqq = Rnd
Response.Cookies("name")=qqq
end if
%>
<script type="text/javascript" language="JavaScript1.2"
src="prototype-1.4.0.js"></script>
<script>
var x=0;
var http = createRequestObject();
function createRequestObject() {
var objAjax;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
objAjax = new ActiveXObject("Microsoft.XMLHTTP");
}else{
objAjax = new XMLHttpRequest();
}
return objAjax;
}
function getNewContent(){
http.open('get','login.asp?cookie=<% =request.Cookies("name") %>');
http.onreadystatechange = updateNewContent;
http.send(null);
return false;
}
function updateNewContent(){
x++;
if(http.readyState == 4){
document.getElementById('mySentence').innerHTML = http.responseText +x
;
}
}
new PeriodicalExecuter(getNewContent, 4);
</script>
..
..
..
login.asp
<%
if instr(Application("loged"), Request.QueryString("cookie"))=0 then
Application("loged")= Application("loged") & "|" &
Request.QueryString("cookie")
end if
response.write Application("loged")
%>
When the page is refreshed with AJAX function, no new names are shown
on the page. But when I click f5 (refresh) all conection do appear.
Any idea what's wrong??
make the self updating list of the users online - based on thier
cookies. In my opinion all seems to be writen well with it's logic, but
computer thinks otherwise. I use application("loged") to store the
cookies of all users.
Here is a code:
main.asp
<%
if len(request.Cookies("name"))=0 then
Randomize
qqq = Rnd
Response.Cookies("name")=qqq
end if
%>
<script type="text/javascript" language="JavaScript1.2"
src="prototype-1.4.0.js"></script>
<script>
var x=0;
var http = createRequestObject();
function createRequestObject() {
var objAjax;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
objAjax = new ActiveXObject("Microsoft.XMLHTTP");
}else{
objAjax = new XMLHttpRequest();
}
return objAjax;
}
function getNewContent(){
http.open('get','login.asp?cookie=<% =request.Cookies("name") %>');
http.onreadystatechange = updateNewContent;
http.send(null);
return false;
}
function updateNewContent(){
x++;
if(http.readyState == 4){
document.getElementById('mySentence').innerHTML = http.responseText +x
;
}
}
new PeriodicalExecuter(getNewContent, 4);
</script>
..
..
..
login.asp
<%
if instr(Application("loged"), Request.QueryString("cookie"))=0 then
Application("loged")= Application("loged") & "|" &
Request.QueryString("cookie")
end if
response.write Application("loged")
%>
When the page is refreshed with AJAX function, no new names are shown
on the page. But when I click f5 (refresh) all conection do appear.
Any idea what's wrong??