Home > Article > Backend Development > ajax2—solve cache problems—php (28), ajax2 cache_PHP tutorial
5. ajax quick start
ajax code:
Php program:
Php code:
ajax calculates the sum of two numbers
7. Solving cache problems
Questions above:
Change addition in php to subtraction
If the previous request parameter is used, it is still found to be addition. If it is a new request parameter, it is subtraction.
Solution 1: Random number
Math.random();
Solution 3. Set request header
setRequestHeader("If-Modified-Since","0");
Solution4. Set response header
header("Cache-Control: no-cache, must-revalidate");