如何使用Jquery或javascript清除缓存?
上传画廊照片时,将旧图像更新为新图像后,缩略图将显示在模型中(使用jquery和php与ajax)。但下一次打开模型时,它会显示较旧的模型,刷新页面后,只会显示较新的图像。有谁能给我解决问题的办法吗? 提前谢谢 这是我的密码- $.ajax({ cache:false, }) 缓存未从以下代码中清除-如何使用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
$.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>`