I was in search of a way to show a status indicator using jQuery and I found a solution in the jQuery Cookbook, it showed this solution
(function($) {
$(document).ready(function() {
$('#ajaxStatus')
.ajaxStart(function() {
$(this).show();
})
.ajaxStop(function() {
$(this).hide();
});
.....
})(jQuery);
then it cautioned,
If you experience performance issues in your application, it may be because of the cost of event propagation if there is a significantly large number of elements. In this case, setting global to false may give you a performance improvement.
So first should I use the solution showed above and will it be a performance issue as my site and js code gets larger and larger?
Should I avoid jQuery global events, just turn it off like the paragraph says?
Lastly, how do you guys show a simple indicator while an ajax request is being performed?