Home > Backend Development > PHP Tutorial > How to solve ajax cache problem_PHP tutorial

How to solve ajax cache problem_PHP tutorial

WBOY
Release: 2016-07-21 15:58:47
Original
866 people have browsed it

I used PHP and 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 solve it?
Ajax caching problem solution:
It is a caching problem.
Add header("Cache-Control: no-cache, must-revalidate") on the server;
And add a random or time string in your JS submission parameters
url+"?timeStamp= "+new Date().getTime();

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/317484.htmlTechArticleI used PHP and Ajax. After adding the 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. The above...
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