Hello everyone,

I am trying to show an animated spinwheel image when I am making a servlet call, and hiding it, once the call comes back in my JS method.
The following code displays the image alright, but fails to hide it, once the call comes back.

JSP

<div id="spin" class="modal" style="display: none"> 
    <div class="center"> 
        <img alt="" src="../Images/spin.gif" /> 
     </div> 
 </div>

JS

$("#btnSubmit").click(function(e) {
                document.getElementById('spin').style.display="block";
                callToServlet();
                document.getElementById('spin').style.display="hidden";
                // ... do something else
        }); 

Any suggestion as where I am going wrong, please?

Are you doing an AJAX call to the servelet? If you are you can try putting your hide code in the response method tot he call. it should get called there.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.