Few days ago, I was working on a project where in a webpage one field was getting populated through AJAX.
To my surprise, the response from the server that I was getting was not the one that I expected. Page doesn't display new data. Then i searched the problem on internet and came to know that Internet Explorer (IE) caches the AJAX request. So if I make ajax queries with same URL, it tends to give me same old output as IE caches the data that it gets from previous query.
To solve this problem, I appended a counter or random number with my url. it worked.
.
.
var count =Math.random();
if (httpObject != null)
{
httpObject.open("GET", "getinfo.php?request=" + request + "&val=" + val + "&count=" + count++, true);
httpObject.send(null);
.
.
.
No comments:
Post a Comment