【问题标题】:IE image caching with jQuery form: Force image reloading使用 jQuery 表单缓存 IE 图像:强制图像重新加载
【发布时间】:2012-03-01 16:49:27
【问题描述】:

我有以下代码:

$('#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

【问题讨论】:

  • 你的ajaxSubmit()返回了什么代码?

标签: jquery internet-explorer caching


【解决方案1】:

试试这个:

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

【讨论】:

  • 加载器是改变缓存的图像吗?我的坏...:/
猜你喜欢
  • 1970-01-01
  • 2019-10-21
  • 2011-10-04
  • 1970-01-01
  • 1970-01-01
  • 2011-12-15
  • 1970-01-01
  • 1970-01-01
  • 2015-12-13
相关资源
最近更新 更多