Our highest priority is to satisfy the customer through early and continuous delivery of valuable and working software.

Friday, December 21, 2007

Ajax cache problem in IE

By default IE will cache all Ajax requests. If you make a same Ajax request again without clearing cache, every time you will get same data, instead of fresh data.

So, what's the solution?

Solution: Use either the date and time or a random number in the query string to force IE to reload the relevant document.

Example:
var QueryString = "request_id=x";
var DatetimeQueryString = “&datetime=”+new Date().getTime();
var url = “request_url.php?”+QueryString+DatetimeQueryString;
httpRequest.open(”GET”, url, true);
httpRequest.onreadystatechange = update;
httpRequest.send(null);

2 comments:

  1. hi, this article helps me a lot. thank you.

    ReplyDelete
  2. Hi Nice Blog .Linking will increase your seo indiaand writing articles with your main website address in the author's information area will provide a one way link which is the best link you can get. If you want your articles spread all over the internet with your one way link, paid article submission services are by far the best and easiest way to go.

    ReplyDelete