简体   繁体   中英

AJAX Refresh or Cache Issue in Wordpress

my Problem: I have a Table that refreshes every 8 seconds via the Plugin "Tablepress Ajax Refresh". Inside that Table is an Image-Gallery which changes Images everytime after a reload (another Plugin called "random images")!

It all works perfectly when I'm logged in to wordpress. But as a non-logged-in-User the Image Gallery won't change. The Ajax Reload is still working - only the Gallery wont change.

I guess it has to do with the Ajax Hooks. But I'm really lost here and don't know how I can get it to work like it does, when I'm logged in to Wordpress. Or maybe it's a caching problem for non-logged-in-users??

In short: Ajax clears cache of the refreshed site(in this case table) only when logged in as admin on wordpress.

If it helps, this is the one and only PHP File for the used ajax-refresh-plugin:

https://gist.github.com/atreju2204/7564597

Any suggestions??

oh and the actual ajax reaload works fine as a non-admin!! So i think maybe some kind of an "clear cache before ajax reload"-thing is not working properly

Avoid caching by making the URL unique with javascript

url='yourpage.php';
url = url + '?_ts=' + new Date.getTime().toString();

If there are already querystring vars

url='yourpage.php?a=b&c=d';
url = url + '&_ts=' + new Date.getTime().toString();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM