My need is very simple. When a user try to log in and submit the login form, i would to display an ajax loader icon (like ones generated at http://www.ajaxload.info) in foreground with the background transparent and unclickable (like in this site). when the server has finished, it can display the next page or redisplay the old one with the errors.
How can i do that?
Thank you very much in advance.
Using jQuery (which is a great javascript library and has hundreds of uses besides this one)
you can detect the submit event on the form and take some action, like this:
To acheive the unclickable div, try some css like this:
and put the div just inside the body tag. when it is faded in, it will be ‘above’ the rest of the page, making it unclickable. just put your ajax loading icon inside this div so it will show up, too.
You can get jQuery from http://jquery.com and I highly recommend using it anyway, even if not for this. Hope this helps
Update:
The new jQuery
on()method has effectively replaced.submitand.clicketc since version1.7, so I’ve updated this example to reflect that. More info here: http://api.jquery.com/on/