I was trying to display a jQuery UI dialog with a spinner GIF inside it. Originally the GIF coded statically in HTML:
<div id="LoadingDiv" style="display:none; text-align: center">
<img alt="Loading..." src='/Content/images/ajax-loader.gif' />
</div>
However there were known issues in IE that prevent GIF images to be animated correctly in a jQuery UI dialog. So I have resorted to dynamically append a img
element to the div
element:
$("#FilterForm").submit(function (){
$("#LoadingDiv").html($("<img>").attr({
'id':'spinner',
'alt':'Loading...',
'src': '@Url.Content("~/Content/images/ajax-loader.gif")'
}));
$("#LoadingDiv").dialog("open");
});
This created some strange bugs to the system. When the form is submitted, sometimes the GIF is displayed and sometimes it isn't. Can somebody help?