One way to do this is to use global events of jquery ajax, as below

$("#ajaxLoading").bind("ajaxSend", function(){
                   $(this).show();
                 }).bind("ajaxComplete", function(){
                   $(this).hide();
                 });
pls note this will show a loading message for all jquery ajax
operations from your page, if you want to restrict only to a specific
operaton you can bind this to current ajax call.
---------------------------
<div id='ajaxLoading'>Loading..</div>
---------------------------
#ajaxLoading{
        position: absolute;
        top:2px;
        left:95%;
        padding:5px;
        background-color: #CC0000;
        color:white;
}

macsig wrote:
> Hi guys,
> I'm working on a Rails app connected to a legacy database.
> Since the reading process from the database takes several seconds (up
> to ten) I would like to display a loading message while the page is
> loading.
>
> Can I achieve that using jQuery? If so how?
>
> Thanks and have a nice day.
>
>
> Sig

Reply via email to