jQuery形式的IE图像缓存:强制重新加载图像
问题描述:
我有以下代码:
$('#imageform').submit(function() {
$("#imageBox").html('');
$("#imageBox").html('<img src="img/loader.gif" alt="Uploading...."/>');
$("#imageform").ajaxSubmit(
{
target: '#imageBox',
resetForm: true
});
return false;
});
在IE中,图像将被缓存并且不会重新加载,我想强制其刷新.问题是我在PHP文件中重命名了图像,因此我想知道如何添加图像加载后的参数(日期).
In IE, the image will be cached and not reload, I wanted to force it to refresh. The problem is that I rename the image in a PHP file, so I wanted to know how to add a paramter (?date) AFTER the image is loaded.
答
尝试一下:
var counter = 0;
...
$("#imageBox").html('<img src="img/loader.gif?c='+counter+'" alt="Uploading...."/>');
counter++';