21302 Posts in 5736 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2850 Views |
-
Loading ajax content - caching woes

11 May 2009 at 2:00pm
Hi all,
I've having an issue with cached content loaded by Ajax.
I'm using jQuery and have disabled browser caching for jQuery ajax requests. I've disabled the SS cache (with HTTP::set_cache_age set to 0). I have cleared the browser cache and rebuilt/flushed. Despite this, content loaded via ajax seems to be coming from a cache. I have to append the ajax query with ?flush=1 to force the response to be updated.
Anyone got a better way?
Thanks!
-
Re: Loading ajax content - caching woes

11 May 2009 at 2:03pm
By the way, the Wiki says that:
"Ajax requests are never cached."
But that is not what I'm seeing.
-
Re: Loading ajax content - caching woes

12 May 2009 at 2:44pm Last edited: 12 May 2009 3:05pm
Are you using Internet Explorer? According to this page:
http://docs.jquery.com/Ajax/load
...IE caches the requests:
Note: Keep in mind that Internet Explorer caches the loaded file, so you should pass some extra random GET parameter to prevent caching if you plan to call this function more than once
Even if not you could try appending a random GET string to the URL you're calling via AJAX and see if that helps.
-
Re: Loading ajax content - caching woes

13 May 2009 at 8:59am
Thanks David, that occurred to me, but I didn't think it would be necessary. I was using FF3 to see the requests.
-
Re: Loading ajax content - caching woes

13 May 2009 at 10:17am
No worries - did that fix it or was there some other solution?
-
Re: Loading ajax content - caching woes

13 May 2009 at 10:20am
Yes, it seems to have done the trick.
-
Re: Loading ajax content - caching woes

9 August 2010 at 4:43am
I have a problem with Ajax in IE 8 Method does not work load. I try to add a URL to a random number
$("#test").load('My_Controller?random=' + Math.random()*99999,data,function(vystup){
var obj = jQuery.parseJSON(vystup);
alert("Hello!!!");
..........
but still nothing. In FF, Safari, Chrome works, but unfortunately Explorer Sun You have some additional advice on how to fix it -
Re: Loading ajax content - caching woes

26 September 2010 at 1:27am
Hi, would you be able to post some example of your ajax code. I am wanting to do a something like this:
$('input.action').click(function() {
$(this).parent().parent().find("form").fadeOut();
$(this).append('<img src="images/ajax-loader.gif" class="loaderIcon" alt="Loading..." />');var Name = $('input#name').val();
var Email = $('input#email').val();
var Comments = $('textarea#comments').val();$.ajax({
type: 'post',
url: 'sendEmail.php',
data: 'Name=' + Name + '&Email=' + Email + '&Comments=' + Comments,success: function(results) {
$('img.loaderIcon').fadeOut(1000);
$('.content').html(results);
}
}); // end ajax
});Thanks for any help you can advice me on.
| 2850 Views | ||
|
Page:
1
|
Go to Top |




