One portion of my script that pertains to the question is as follows:
<script type="text/javascript>
function handleImageClick() {
var image = $("#image_id");
$(image).attr("src", "ajax-loader.gif");
$.ajax({
// do other stuff
complete: function () {
$(image).attr("src", "default.gif"); // ***
}
});
}
</script>
Everything runs smoothly in Firefox and IE-8, but there's an issue in Google Chrome (version 21.0.1180.83). The loading image appears briefly before the complete
function is called. Although the image source changes to default.gif
, it does not display properly. I have confirmed that the src
attribute of the image element has been changed, but a blank space remains.
Is this a common issue with an easy fix? Or should I revisit the extensive handleImageClick
function?