Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Getting stale data via ajax
Old 07-22-2008, 11:24 PM Getting stale data via ajax
Sleeping Troll's Avatar
Ultra Talker

Posts: 351
Name: Butch Begy
Trades: 0
I call this code from a page via ajax and it does not pick up newly added records just the same old records over and over!

This is my server side script:

Code:
<!-- #include file = "DSN.asp" -->
<%
Set rs=Server.CreateObject("ADODB.RecordSet")
rs.ActiveConnection = conn
rs.open ("SELECT top 1 time FROM calls INNER JOIN cliente INNER JOIN p1 ON cliente.id_cli = p1.clie INNER JOIN p2 ON p1.id_p1 = p2.p1 INNER JOIN p3 ON p2.id_p2 = p3.p2 INNER JOIN p4 ON p3.id_p3 = p4.p3 ON calls.number = p4.c2 WHERE(cliente.id_cli = 30) order by time desc")
Resp = rs.fields("time")
rs.close
Set rs = nothing
conn.close 
Response.Write(Resp)
%>
When I go to this script via url the data is fresh and it poicks up any changes, however when I call it from the client it returns old data, it does not pick up new records, what is going on?

P.S. MSSQL Database.
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-23-2008, 02:16 AM Re: Getting stale data via ajax
Super Talker

Posts: 104
Location: http://www.joomladevs.com
Trades: 0
I don't think it will give you different output while calling from client side. I think you are not clearing prev data.. Can I see the client side code ?
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE


saurabhj is offline
Reply With Quote
View Public Profile Visit saurabhj's homepage!
 
Old 07-23-2008, 05:56 AM Re: Getting stale data via ajax
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,515
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Try:

setting the cursorlocation to be clientside (default is serverside)
rs.cursorlocation = adUseClient
http://www.devguru.com/technologies/ado/8650.asp

and a dynamic CursorType
rs.cursortype = adOpenKeyset
http://www.devguru.com/technologies/ado/8651.asp

set these before opening the recordset.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-23-2008, 07:59 AM Re: Getting stale data via ajax
Sleeping Troll's Avatar
Ultra Talker

Posts: 351
Name: Butch Begy
Trades: 0
I have tried every cursor under the sun and same result, script is queying data not client. but here is clientside script.


Code:
 
function Refresh()
{
var xmlHttp;
try
{ // Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{ // Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
var t=setTimeout("Refresh()",10000);
var Rsp=xmlHttp.responseText;
alert(Tst)
alert(Rsp)
if(Tst != Rsp)
{
Tst = Rsp;
window.location.href="b_monito.asp?"+Rsp;
}
}
}
xmlHttp.open("Get","update.asp",true);
xmlHttp.send(null);
}
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
Old 07-28-2008, 09:31 PM Re: Getting stale data via ajax
Sleeping Troll's Avatar
Ultra Talker

Posts: 351
Name: Butch Begy
Trades: 0
FYI, Response.Expires = -1000
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Getting stale data via ajax
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.21252 seconds with 12 queries