2012-02-09 30 views
0

我有以下代码:IE缓存图像使用jQuery形式:强制图像重装

$('#imageform').submit(function() { 
    $("#imageBox").html(''); 
    $("#imageBox").html('<img src="img/loader.gif" alt="Uploading...."/>'); 
    $("#imageform").ajaxSubmit(
    { 
     target: '#imageBox', 
     resetForm: true 
    }); 
    return false; 
}); 

在IE浏览器,图像将被缓存,而不是重装,我想迫使它刷新。问题是我在一个PHP文件中重命名图像,所以我想知道如何添加一个参数(?date)AFTER图像被加载。

+0

正在从你的'ajaxSubmit会()'返回的代码是什么? – 2012-02-09 07:47:39

回答

1

试试这个:

var counter = 0; 
... 
$("#imageBox").html('<img src="img/loader.gif?c='+counter+'" alt="Uploading...."/>'); 
counter++'; 
+0

加载器是改变缓存的图像?我的错... :/ – 2012-02-09 07:52:19