On 5/20/07, bingo <[EMAIL PROTECTED]> wrote:
jQuery.fn.customLoad = function(url){ return $(this).ajaxStart(function(){ $(this).html("<div align=\"center\"><img src=\"/cake2/img/images/ loadingAnimation.gif\" /></div>"); $(this).load(url); }); }; As you can see, I am just trying over write load function so that whenever any div is being loaded, just attach a new div that display loading animation.
Try this: jQuery.fn.customLoad = function(url){ $(this).bind("ajaxStart", function(){ $(this).html("<div align=\"center\"><img src=\"/cake2/img/images/loadingAnimation.gif\" /></div>"); }); $(this).bind("ajaxStop", function(){ $(this).unbind("ajaxStart"); }); return $(this).load(url); }; I found the unbind necessary to keep ajaxStart from being called a second time after the element is loaded. I think this may be a bug. - Richard D. Worth