I have an image on a web page that is dynamically generated by server side CGI program. This image is periodically updated by the timer and / or changed based on user input. So I have a Javascript function like
function reloadImage() {
$("#screen").attr("src", make_cgi_url_based_on_form_inputs());
}
This works fine, but sometimes it takes a while to load the image. Therefore, I would like some kind of message to appear that says "Loading image ...", but then this image will disappear when the image is downloaded and displayed in the browser.
Are there any Javascript events that can do this? Alternatively, is there another way to upload / modify / update the image and determine when the download is complete, via Ajax or something else?
source
share