M
matt.delvecchio
hello,
im working on my first production AJAX project, and im noticing
something weird.
when my clientside events fire (user clicks on various product rows), i
make an xmlhttp call. in this call i hit a URL and pass it the clicked
productID, such as: "/ajax/productDetail.aspx?pid=666666". this page
produces XML direct from the database and i render it onscreen. cool.
but what ive noticed is, if this data changes in the db, the AJAX
clientside requests dont get the latest data . but, if i hit the
"/ajax/productDetail.aspx?pid=666666" url directly in a web browser
(where i can see the fresh data), and then go *back* to the clientside
app & try again, it gets the latest data!
so on the surface it looks like the ajax calls to the URL are somehow
cached. can anyone speak to this possibility?
i am running IE 6, win, IIS 5.
my code:
var xmlhttp = false;
//win/IE
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
xmlhttp = false;
}
}
//make the call
xmlhttp.open("GET", url, false); //setting async to false due to
previous lag
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4) //ready
{
if (xmlhttp.status == 200) //success
{
var xml = xmlhttp.responseXML;
if (xml.documentElement){
// [does rendering stuff]
}
} else {
alert('There was a problem retrieving the data:\n' +
xmlhttp.statusText);
}
}
xmlhttp.send(null)
}
.....this code successfully produces the xml object that i then render
into htlml DIV tags. but the data its getting is stale.
thanks!
matt
im working on my first production AJAX project, and im noticing
something weird.
when my clientside events fire (user clicks on various product rows), i
make an xmlhttp call. in this call i hit a URL and pass it the clicked
productID, such as: "/ajax/productDetail.aspx?pid=666666". this page
produces XML direct from the database and i render it onscreen. cool.
but what ive noticed is, if this data changes in the db, the AJAX
clientside requests dont get the latest data . but, if i hit the
"/ajax/productDetail.aspx?pid=666666" url directly in a web browser
(where i can see the fresh data), and then go *back* to the clientside
app & try again, it gets the latest data!
so on the surface it looks like the ajax calls to the URL are somehow
cached. can anyone speak to this possibility?
i am running IE 6, win, IIS 5.
my code:
var xmlhttp = false;
//win/IE
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
xmlhttp = false;
}
}
//make the call
xmlhttp.open("GET", url, false); //setting async to false due to
previous lag
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4) //ready
{
if (xmlhttp.status == 200) //success
{
var xml = xmlhttp.responseXML;
if (xml.documentElement){
// [does rendering stuff]
}
} else {
alert('There was a problem retrieving the data:\n' +
xmlhttp.statusText);
}
}
xmlhttp.send(null)
}
.....this code successfully produces the xml object that i then render
into htlml DIV tags. but the data its getting is stale.
thanks!
matt