Can you clear jquery ajax cache?

Posted by chobo2 on Stack Overflow See other posts from Stack Overflow or by chobo2
Published on 2010-06-02T19:10:07Z Indexed on 2010/06/02 19:14 UTC
Read the original article Hit count: 507

Filed under:
|

Hi

I am wondering is it possible to clear the cache from a particular ajax method?

Say if I have this

$.ajax({
  url: "test.html",
  cache: true,
  success: function(html){
    $("#results").append(html);
  }
});

Now 99% of the time a cached result can be used since it should always be same content. However if a user updates this content it of course changes. If it is cached and it would still show the old content.

So it would be cool if I could pick out this cache for this method and clear it and all other cached stuff would stay.

Can this be done?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-ajax