AJAX loading notice based on Prototype
Loading Notice is a javascript plugin, built on Prototype, which automatically shows an indictor when a slow AJAX is under process. Basically, it’s like the “loading” div appears in gmail when busy. And when the users scroll or resize the window, it will still keep showing on the top of the page.
Check it out here: http://github.com/shaokun/loading_notice/tree/master
HOWTO
1. Install the plugin:
$ ruby script/plugin install git://github.com/shaokun/loading-notice.git
$ rake loading_notice:install
2. Include the library into your project:
<%= javascript_include_tag 'prototype', 'loading_notice' %>
<%= stylesheet_link_tag 'loading_notice' %>
3. Add a “loading” div and initialize a javascript object:
<div id="loading" style="display: none">Loading...</div>
<script type="text/javascript">
window.onload = function() {
window.loading_notice = new LoadingNotice("loading");
}
</script>
4. That’s all!

<%=loading_notice('等一下')%>