Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/464.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用Jquery或javascript清除缓存?_Javascript_Php_Jquery_Ajax - Fatal编程技术网

如何使用Jquery或javascript清除缓存?

如何使用Jquery或javascript清除缓存?,javascript,php,jquery,ajax,Javascript,Php,Jquery,Ajax,上传画廊照片时,将旧图像更新为新图像后,缩略图将显示在模型中(使用jquery和php与ajax)。但下一次打开模型时,它会显示较旧的模型,刷新页面后,只会显示较新的图像。有谁能给我解决问题的办法吗? 提前谢谢 这是我的密码- $.ajax({ cache:false, }) 缓存未从以下代码中清除- $.ajax({ cache:false, }) 您可以尝试使用JavaScriptwindow.location.replace()函数: <meta http-equiv="re

上传画廊照片时,将旧图像更新为新图像后,缩略图将显示在模型中(使用jquery和php与ajax)。但下一次打开模型时,它会显示较旧的模型,刷新页面后,只会显示较新的图像。有谁能给我解决问题的办法吗? 提前谢谢

这是我的密码-

$.ajax({ cache:false, })

缓存未从以下代码中清除-

$.ajax({
   cache:false,
})

您可以尝试使用JavaScript
window.location.replace()
函数:

<meta http-equiv="refresh" content="0; http://www.redirecturl.com/" />
<meta http-equiv="pragma" content="no-cache">
<script type="text/javascript">
window.location.replace('URL');
</script>`

window.location.replace('URL');
`

apply cache:truedoc明确指出
cache:false
仅适用于
HEAD
GET
requests您可以更好地了解此处有关缓存管理的详细信息->对,那么对于POST方法,应该使用什么?解决方案可能是“完全忘掉Ajax吧。看看你的
。不要回收缩略图的URL“但你的问题不包括。我需要清除ajax调用缓存。有任何解决方案,请ping me.$(document).ready(function(){$('img')。each(function()){var date=new date;//将当前unix时间戳(以微秒为单位)作为查询字符串this.src=this.src+'?'+date.getTime();})添加到映像src中;
<meta http-equiv="refresh" content="0; http://www.redirecturl.com/" />
<meta http-equiv="pragma" content="no-cache">
<script type="text/javascript">
window.location.replace('URL');
</script>`