Rails 3 – w jQuery – Global Loading Event? – Education Career Blog

is there a Rails 3 jQuery global loading event?

I’d like to display a LOADING banner anytime jQuery is AJAX loading… and remove it when it’s done…

Ideas? Thanks

,

For global do this :

$("#loading").bind("ajaxSend", function(){
  $(this).show();
}).bind("ajaxComplete", function(){
  $(this).hide();
});

For individual do this :

$.ajax({type: "GET",
        beforeSend: function() { $.globalThrobberStart    },
        complete: function() { $.globalThrobberStop     }
        ...

See more here : http://docs.jquery.com/Ajax_Events

Leave a Comment