I have an old legacy Web app where I can't add jQuery.
When a form is submitted, a long server-side action takes place, and I need to disable 'Submit' until the response is rendered, or maybe the change the cursor.
I found a solution here which shows the Loading banner on Submit, https://stackoverflow.com/a/30906566/1005607
but it doesn't remove it when the page is rendered. There is a Forward action from my Struts Action class. How would I remove the banner once it's finished?
<script type="text/javascript">
function ShowLoading(e) {
var div = document.createElement('div');
var img = document.createElement('img');
img.src = 'loading_bar.GIF';
div.innerHTML = "Loading...<br />";
div.style.cssText = 'position: fixed; top: 5%; left: 40%; z-index: 5000; width: 422px; text-align: center; background: #EDDBB0; border: 1px solid #000';
div.appendChild(img);
document.body.appendChild(div);
return true;
// These 2 lines cancel form submission, so only use if needed.
//window.event.cancelBubble = true;
//e.stopPropagation();
}
</script>
<form onsubmit="ShowLoading()">
</form>