On a lot of sites lately, I've seen buttons being replaced with loading/thinking images after they are pressed, to prevent double clicks and make sure the user knows something is going on before the page flickers off. In this case, nothing asynchronous is actually happening -- just a regular form submit.
Know of any good tutorials for how to do this?
Although simply replacing the submit with an image might work, removing the button might prevent the submit input's value from being sent (like when it's disabled). This can cause problems for some applications that rely on the submit's value being sent to the server - for example testing which submit button the user has pressed or using the same controller for many actions.
For those cases, you can use another method that works just as good - hiding the submit and adding an image:
I think you are looking for this one ,button have this function
updatemycartpage()
in onclick eventEvent can be binded on form as a standard practice
my way of doing this:
credits: https://github.com/phpawy/jquery-submit-once
Go the simplest way. Say your button is btnSubmit.
Now using jquery, on click of the button:
The submit button will be disabled, the animating image loading.gif will show up. And the page will postback. The benefit is that if validation fails you can again enable the submit button and hide the loading image. In such case, obviously you will show the error message.
Simply remove the submit button and replace it with your image (do this from an onclick event).