jQuery形式的IE图像缓存:强制重新加载图像 [英] IE image caching with jQuery form: Force image reloading

查看:103
本文介绍了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++';

这篇关于jQuery形式的IE图像缓存:强制重新加载图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆