Jörn Zaefferer schrieb: > Hi folks, > > which of the following examples of global ajax handlers make more sense > and are easier to understand? > > $("#msg").ajaxSuccess(function(){ > $(this).append("<li>Successful Request!</li>"); > }); > > or > > $.ajaxSuccess(function(){ > $("#msg").append("<li>Successful Request!</li>"); > }); > > With chaining: > $("#msg").ajaxStart(function(){ > $(this).show(); > }).ajaxStop(function() { > $(this).hide(); > }); > > or > > var msg = $('#msg'); > $.ajaxStart(function() { > msg.show(); > }); > $.ajaxStop(function() { > msg.hide(); > }); > > Your opinion is appreciated. > > -- Jörn
Hi Jörn, I like chaining most! Although I think the following might make more sense anyway: $.ajax({ ... stop: function() {}, start: function() {}, ... }); That way I have more control over which XHR requests are displayed. There may be some that the user is not aware of and does not need to be (validation, ping etc.) -- Klaus _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/