473,569 Members | 2,383 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("lo ged") to store the
cookies of all users.

Here is a code:

main.asp
<%
if len(request.Coo kies("name"))=0 then
Randomize
qqq = Rnd
Response.Cookie s("name")=qqq
end if
%>
<script type="text/javascript" language="JavaS cript1.2"
src="prototype-1.4.0.js"></script>
<script>
var x=0;
var http = createRequestOb ject();
function createRequestOb ject() {
var objAjax;
var browser = navigator.appNa me;
if(browser == "Microsoft Internet Explorer"){
objAjax = new ActiveXObject(" Microsoft.XMLHT TP");
}else{
objAjax = new XMLHttpRequest( );
}
return objAjax;
}

function getNewContent() {
http.open('get' ,'login.asp?coo kie=<% =request.Cookie s("name") %>');
http.onreadysta techange = updateNewConten t;
http.send(null) ;
return false;
}

function updateNewConten t(){
x++;
if(http.readySt ate == 4){
document.getEle mentById('mySen tence').innerHT ML = http.responseTe xt +x
;
}
}

new PeriodicalExecu ter(getNewConte nt, 4);
</script>
..
..
..
login.asp

<%
if instr(Applicati on("loged"), Request.QuerySt ring("cookie")) =0 then
Application("lo ged")= Application("lo ged") & "|" &
Request.QuerySt ring("cookie")
end if
response.write Application("lo ged")
%>
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 3395
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("lo ged") 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.Coo kies("name"))=0 then
Randomize
qqq = Rnd
Response.Cookie s("name")=qqq
end if
%>
<script type="text/javascript" language="JavaS cript1.2"
src="prototype-1.4.0.js"></script>
<script>
var x=0;
var http = createRequestOb ject();
function createRequestOb ject() {
var objAjax;
var browser = navigator.appNa me;
if(browser == "Microsoft Internet Explorer"){
objAjax = new ActiveXObject(" Microsoft.XMLHT TP");
}else{
objAjax = new XMLHttpRequest( );
}
return objAjax;
}

function getNewContent() {
http.open('get' ,'login.asp?coo kie=<% =request.Cookie s("name") %>');
http.onreadysta techange = updateNewConten t;
http.send(null) ;
return false;
}

function updateNewConten t(){
x++;
if(http.readySt ate == 4){
document.getEle mentById('mySen tence').innerHT ML = http.responseTe xt +x
;
}
}

new PeriodicalExecu ter(getNewConte nt, 4);
</script>
.
.
.
login.asp

<%
if instr(Applicati on("loged"), Request.QuerySt ring("cookie")) =0 then
Application("lo ged")= Application("lo ged") & "|" &
Request.QuerySt ring("cookie")
end if
response.write Application("lo ged")
%>
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("lo ged") 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.Coo kies("name"))=0 then
Randomize
qqq = Rnd
Response.Cookie s("name")=qqq
end if
%>
<script type="text/javascript" language="JavaS cript1.2"
src="prototype-1.4.0.js"></script>
<script>
var x=0;
var http = createRequestOb ject();
function createRequestOb ject() {
var objAjax;
var browser = navigator.appNa me;
if(browser == "Microsoft Internet Explorer"){
objAjax = new ActiveXObject(" Microsoft.XMLHT TP");
}else{
objAjax = new XMLHttpRequest( );
}
return objAjax;
}

function getNewContent() {
http.open('get' ,'login.asp?coo kie=<% =request.Cookie s("name") %>');
http.onreadysta techange = updateNewConten t;
http.send(null) ;
return false;
}

function updateNewConten t(){
x++;
if(http.readySt ate == 4){
document.getEle mentById('mySen tence').innerHT ML = http.responseTe xt +x
;
}
}

new PeriodicalExecu ter(getNewConte nt, 4);
</script>
.
.
.
login.asp

<%
if instr(Applicati on("loged"), Request.QuerySt ring("cookie")) =0 then
Application("lo ged")= Application("lo ged") & "|" &
Request.QuerySt ring("cookie")
end if
response.write Application("lo ged")
%>
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("lo ged") 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.Coo kies("name"))=0 then
Randomize
qqq = Rnd
Response.Cookie s("name")=qqq
end if
%>
>
>
<script type="text/javascript" language="JavaS cript1.2"
src="prototype-1.4.0.js"></script>
<script>
var x=0;
var http = createRequestOb ject();
function createRequestOb ject() {
var objAjax;
var browser = navigator.appNa me;
if(browser == "Microsoft Internet Explorer"){
objAjax = new ActiveXObject(" Microsoft.XMLHT TP");
}else{
objAjax = new XMLHttpRequest( );
}
return objAjax;
}
>
function getNewContent() {
http.open('get' ,'login.asp?coo kie=<% =request.Cookie s("name") %>');
http.onreadysta techange = updateNewConten t;
http.send(null) ;
return false;
}
>
function updateNewConten t(){
x++;
if(http.readySt ate == 4){
document.getEle mentById('mySen tence').innerHT ML = http.responseTe xt +x
;
}
}
>
new PeriodicalExecu ter(getNewConte nt, 4);
</script>
.
.
.
>
>
login.asp
>
<%
if instr(Applicati on("loged"), Request.QuerySt ring("cookie")) =0 then
Application("lo ged")= Application("lo ged") & "|" &
Request.QuerySt ring("cookie")
end if
response.write Application("lo ged")
%>
>
>
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
1948
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
4839
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 server. I have pretty much figured out two ways to this. One way involves AJAX. The other way involves using cookies. I think AJAX is awesome, but...
7
3592
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
4017
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 technology is implemented on more sites now than ever. Compatibility is no longer an issue (IE, Mozilla and Opera all support it), and the benefits to...
3
2311
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 web site in VS 2005 and select ASP.Net AJAX - Enabled Site and then copy my all the web forms and datasets from my existing web application to this...
6
5128
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 application working. However, when attempting to implement the solution, the AJAX calls weren't updating the screen like the examples were and...
16
2022
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 (using ajax) and print them on the browser? (The thing is the asp page is still running over at the server...while it is running I would want to...
11
1514
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 pages were created. Thanks. Jonathan
2
1642
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 Firefox, and thumbnails appear based on what you clicked on. Do the same in IE6, and it returns an error: Line: 71 Char: 9 Error: Unknown...
0
7703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main...
0
7926
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8132
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7678
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7982
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6286
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3656
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
944
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.