1

I have a site where items are loaded onto a page in the DOM as I'm using a masonry type effect.

Now, users can delete these items at any time, many at once if they choose to.

The problem is, after deleting, I refresh the page showing the items by reloading it, and the items are still there. Even if I leave the page and return the items are still there. But they have definitely beeen removed from the db table. The only way to clear them from the page is CTRL+R, a complete refresh

How can I clear the DOM cache, or force a refresh? Or is there a better way to do this?

I'm using PHP as main backend lanuguage. I'm also using Jquery.

Not sure what to tag this but think JS and Jquery issue so will start with that.

4

2 に答える 2

1

It's neither a JavaScript nor jQuery issue. It's a caching issue. You need to configure your web server to set the correct cache control headers (Expires and similar) so the browser knows to re-fetch the page. (You can also set them in the PHP response if you need to vary them from page to page by using the header function.)

I won't single out a specific link, but if you search for "cache control" you'll find a million tutorials. :-)

于 2013-02-02T17:35:59.440 に答える
0

Added timestamp to ajax call so it doesn't cache in the first place, simple really when you think about it backwards!

Many thanks for the other answer/comment

于 2013-02-03T09:10:44.533 に答える