开发者

Rails 3 - w jQuery - Global Loading Event?

开发者 https://www.devze.com 2023-01-21 11:20 出处:网络
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...

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

精彩评论

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