is there a Rails 3 jQuery global loading event?
I'd like to display a LOADING banner anytime jQuer开发者_如何转开发y 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
精彩评论