Home > Backend Development > PHP Tutorial > How to solve ajax caching problem

How to solve ajax caching problem

WBOY
Release: 2016-07-29 08:35:36
Original
917 people have browsed it

I used PHP combined with Ajax. After adding data, I refreshed the front page and the data did not change.
I changed the PHP dynamic script, and I can only see the effect by re-opening IE and entering the address.
Are these the reasons for caching? How to deal with it?
How to solve the ajax cache problem:
It’s a cache problem.
Add header("Cache-Control: no-cache, must-revalidate");
Add a random or time string to your JS submission parameters
url+"?timeStamp="+new Date() .getTime();

The above has introduced the solution to the ajax cache problem, including the solution. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template