It sounds like it's your browser caching the image (which I now notice you wrote in your question). You can force the browser to reload the image by passing an extra variable like so:
原文地址:[url]http://stackoverflow.com/questions/2104949/how-to-reload-refresh-an-elementimage-in-jquery[/url]
d = new Date();
$("#myimg").attr("src", "/myimg.jpg?"+d.getTime());原文地址:[url]http://stackoverflow.com/questions/2104949/how-to-reload-refresh-an-elementimage-in-jquery[/url]
本文介绍了一种使用jQuery的方法来强制浏览器重新加载已缓存的图片。通过为图片源地址添加时间戳作为参数的方式,避免了浏览器使用缓存中的图片,确保每次请求都能获取到最新的图片资源。
1742

被折叠的 条评论
为什么被折叠?



