how to add clock timing indicator?

Hi Expert,

I have a submit button in my .jsp file. When i click , it takes time to display the response.
Can i have some sample code to display waiting icon(some kind of clock indicator) . Once i get response it should not show up?

Thanks,
Alpita

<TR>
  <TD ALIGN=CENTER>
    <INPUT TYPE=BUTTON  ID="butSubmit" VALUE="Submit" onClick="form_submit()">
  </TD>
  <TD ALIGN=CENTER>
    <INPUT TYPE=BUTTON NAME="close" VALUE="Close" onClick="window.close()">
  </TD>
</TR>

Open in new window

AlpitaAsked:
Who is Participating?
 
cmalakarConnect With a Mentor Commented:
You dont need any special environment for AJAX. It works with javascript.

Anyways, Without AJAX, You could do this.

put a empty div in your jsp. And on submit of form, put the required image tag in the div inner html.
Then submit the form.
<div id="imageHere">
</div>

<script>
function form_submit(){
document.getElementById("imageHere").innerHTML = '<img src="image.gif" alt="Alternate text" />';
//submit the form here
}
</script>

Open in new window

0
 
cmalakarCommented:
Better do with AJAX.

On submit of form, show a progress image on the page, Send an ajax request with form details.
Once the ajax request is completed, just forward to the success/failure page based on the ajax request/response result.
0
 
AlpitaAuthor Commented:
In my project environment, they dont use AJAX.
Could it possible in jsp?

Thanks,
Alpita
0
 
AlpitaAuthor Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.