开发者

Rails 3 - w jQuery - Global Loading Event?

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜