0
我正在创建一个ajax滑块来显示图像。它完美的工作,但问题是图像缓存。当图像发生变化时,由于这是ajax负载,因此此处不存在缓存,并且延迟显示图像。我如何显示图像没有任何延迟?这里是我的代码:在ajax加载缓存图像地址
JS:
$(document).ready(function(){
var auto = setInterval(function(){
$("#test").load("ajax.php", {count : count}, function(){
count = count + 1;
if (count == 5) {
count = 0;
}
}).fadeOut(100).fadeIn(100);
},3000);
PHP在ajax.php:
<?php
$pathArray = array("<img src='pic/85.jpg' width='128' height='169'>",
"<img src='pic/18.jpg' width='128' height='169'>",
"<img src='pic/7.jpg' width='128' height='169'>",
"<img src='pic/004.jpg' width='128' height='169'>",
"<img src='pic/26.jpg' width='128' height='169'>"
);
if (isset($_POST["count"])) {
echo $pathArray[intval($_POST["count"])];
}
?>