473,396 Members | 1,971 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

AJAX and Application variable (ASP)

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??

Nov 14 '06 #1
5 3373
Hi,

Ruso wrote:
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.
Any reason why you use ASP? I would move to ASP.NET if I were you, the
model is much much clearer and easier to grasp (though more elaborate)
than in ASP. Also, it's very very easy to debug AJAX in ASP.NET, by
setting breakpoints on both the server and the client. But that's off topic.

About your problem, if I were you, I would check exactly what is sent to
the ASP page, and what is returned. I use Fiddler to do that, it allows
to see the complete request and response. Other tools exist, for example
Firebug for Firefox.

Once you did that, use a client-side debugger to inspect what you
receive, and how your program reacts. On Firefox, you can use Venkman.
On IE, I use Visual Studio 2005, which works excellently.

HTH,
Laurent
>
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??

--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Nov 14 '06 #2
Thanks for reply.

Laurent Bugnion wrote:
Hi,

Ruso wrote:
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.

Any reason why you use ASP? I would move to ASP.NET if I were you, the
model is much much clearer and easier to grasp (though more elaborate)
than in ASP. Also, it's very very easy to debug AJAX in ASP.NET, by
setting breakpoints on both the server and the client. But that's off topic.
I am using ASP because I dont know asp.net at all :(
>
About your problem, if I were you, I would check exactly what is sent to
the ASP page, and what is returned. I use Fiddler to do that, it allows
to see the complete request and response. Other tools exist, for example
Firebug for Firefox.
I will try what you do sugest, and see what is send to each page, but I
do know that the cookie value is passed correctlly. And it's the only
value I do pass to the login.asp page at the moment.
>
Once you did that, use a client-side debugger to inspect what you
receive, and how your program reacts. On Firefox, you can use Venkman.
On IE, I use Visual Studio 2005, which works excellently.
Can you explain this part a bit more??

HTH,
Laurent

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??


--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Nov 14 '06 #3

Ruso wrote:
Thanks for reply.

Laurent Bugnion wrote:
Hi,

Ruso wrote:
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.
Any reason why you use ASP? I would move to ASP.NET if I were you, the
model is much much clearer and easier to grasp (though more elaborate)
than in ASP. Also, it's very very easy to debug AJAX in ASP.NET, by
setting breakpoints on both the server and the client. But that's off topic.

I am using ASP because I dont know asp.net at all :(

About your problem, if I were you, I would check exactly what is sent to
the ASP page, and what is returned. I use Fiddler to do that, it allows
to see the complete request and response. Other tools exist, for example
Firebug for Firefox.

I will try what you do sugest, and see what is send to each page, but I
do know that the cookie value is passed correctlly. And it's the only
value I do pass to the login.asp page at the moment.

Once you did that, use a client-side debugger to inspect what you
receive, and how your program reacts. On Firefox, you can use Venkman.
On IE, I use Visual Studio 2005, which works excellently.

Can you explain this part a bit more??

HTH,
Laurent
>
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??
>

--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch


I used Fiddler to check for the traffic, and I discovered that the page
login.asp is only called once, and I want to call it evry copule of
seconds. So whats wrong with the ajax script then?? Any idea any1??

Nov 14 '06 #4
Hi,

Ruso wrote:
Ruso wrote:
>Thanks for reply.

Laurent Bugnion wrote:
>>Once you did that, use a client-side debugger to inspect what you
receive, and how your program reacts. On Firefox, you can use Venkman.
On IE, I use Visual Studio 2005, which works excellently.
>Can you explain this part a bit more??
I mean that Venkman and Visual Studio 2005 (or 2003 for that matter)
allow you to debug client-side JavaScript, which makes it a big deal
easier to see what's wrong with your code. I'd recommend Venkman,
because it's free and easy to install.
I used Fiddler to check for the traffic, and I discovered that the page
login.asp is only called once, and I want to call it evry copule of
seconds. So whats wrong with the ajax script then?? Any idea any1??
You use an external library named prototype.js. Unfortunately, I have no
idea how it works. I would contact the library's maker and ask.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Nov 14 '06 #5

Laurent Bugnion wrote:
Hi,

Ruso wrote:
Ruso wrote:
Thanks for reply.

Laurent Bugnion wrote:
>Once you did that, use a client-side debugger to inspect what you
receive, and how your program reacts. On Firefox, you can use Venkman.
On IE, I use Visual Studio 2005, which works excellently.
Can you explain this part a bit more??

I mean that Venkman and Visual Studio 2005 (or 2003 for that matter)
allow you to debug client-side JavaScript, which makes it a big deal
easier to see what's wrong with your code. I'd recommend Venkman,
because it's free and easy to install.
I used Fiddler to check for the traffic, and I discovered that the page
login.asp is only called once, and I want to call it evry copule of
seconds. So whats wrong with the ajax script then?? Any idea any1??

You use an external library named prototype.js. Unfortunately, I have no
idea how it works. I would contact the library's maker and ask.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Problem solved. I dont know what was the error, but when I rebuild it
from scratch it worked. :)

Nov 15 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: =?Utf-8?B?bmFuZGFu?= | last post by:
can we convert asp application to ajax using ASP.NET AJAX v1.0 “Core” Beta,if we have not developed our application using ATLAS?. -- nandan
9
by: dougloj | last post by:
Hi. I have an ASP.NET application written in C#. In part of my application, I want to use JavaScript OnClick event function to update a textbox with a string generated asynchronously on the...
7
ak1dnar
by: ak1dnar | last post by:
Hi, I got this scripts from this URL There is Error when i submit the form. Line: 54 Error: 'document.getElementbyID(....)' is null or not an object What is this error. Complete Files
1
by: geevaa | last post by:
http://www.phpbuilder.com/columns/kassemi20050606.php3 XMLHttpRequest and AJAX for PHP programmers James Kassemi Introduction: Although the concept isn't entirely new, XMLHttpRequest...
3
by: bbawa1 | last post by:
I just want to know that I have already a web application. I want to use ajax in one of my web forms. I installed AJAX in my machine. Now to use ajax in my web application should I create a new...
6
by: =?Utf-8?B?U2hhd24gU2VzbmE=?= | last post by:
Greetings! I was researching AJAX to provide a solution to displaying status messages while a long process executed. I found several examples online and was able to use their code to get a quick...
16
by: deostroll | last post by:
Suppose I have an asp page that has a response.write(something) in a loop that would run for a considerable amount of time. Now, from my client browser can I trap those server response messages...
11
by: Jonathan Wood | last post by:
Can anyone point me to any good resources on adding AJAX to a page once the page has already been created? I know VS2008 has options to add AJAX pages, but I didn't select those options when the...
2
by: burtonfigg | last post by:
I'm testing an ajax page - this works fine in Firefox: http://jimpix.co.uk/clients/a/ecards/defaultx.asp Click on any of the links on the right under the 'occassions' or 'others' headings, in...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.