简体   繁体   中英

Loading image freezes after submit button is clicked

I have several JSP pages that use ajax call to do the submit and I can show a loading image before the ajax call and hide it after ajax is completed. This way, the loading image works fine.

 $(document).ajaxComplete(function()
{
    $("#loadingimg").hide();
});

However, I have one page that doesn't use ajax call, it uses normal form action to submit the form. When the submit button is clicked, the server will do a long time processing and the loading image becomes frozen until server comes back and direct to the next page. How do I make the loading image not frozen while server is processing ? Thanks a lot!

 <form:form id= "aForm" name="aForm"  method="post" modelAttribute="attr" 
   action="submit.htm" >

Try putting your image in an iframe, the submit button makes the page stops, but iframe should continue to run. Then show/hide the iframe something like:

<iframe src="<yourimageurl>" id="loading"></iframe>

$("aForm").submit(function (){
   $("#loading").show();
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM