加载后重新加载图像(jquery/javascript)

加载后重新加载图像(jquery/javascript),javascript,jquery,image,load,refresh,Javascript,Jquery,Image,Load,Refresh,我想重新加载一个在服务器上不断更新的图像。到目前为止,我只尝试过: 不幸的是,这还会使图像每100毫秒刷新一次。我的问题是,我想尽快加载新图像。因此,使用更大的时间间隔是没有选择的。非常感谢您的任何想法。尝试使用稍微不同的加载事件: $("#stream").on('load', function() { $("#stream").attr("src", "http://keshira.com:8080/?action=snapshot&" + new Date().g

我想重新加载一个在服务器上不断更新的图像。到目前为止,我只尝试过:






不幸的是,这还会使图像每100毫秒刷新一次。我的问题是,我想尽快加载新图像。因此,使用更大的时间间隔是没有选择的。非常感谢您的任何想法。

尝试使用稍微不同的
加载事件:

$("#stream").on('load', function() {
    $("#stream").attr("src", "http://keshira.com:8080/?action=snapshot&" + new Date().getTime());
});

这是。我在那里使用
setTimeout
只是为了以某种方式限制它,但您可以删除它。

那么这段代码有效吗?是否要更频繁地更新图像?代码会不断更新图像。它应该只在最后一个映像已完全加载的情况下更新映像。感谢您没有足够的jquery知识。
<img id="stream" onload="$(this).data('loaded', 'loaded');" src="http://keshira.com:8080/?action=snapshot"/>
$("#stream").on('load', function() {
    $("#stream").attr("src", "http://keshira.com:8080/?action=snapshot&" + new Date().getTime());
});