// show loading animation and errors inside the container that is being replaced // http://grosser.it/2012/06/21/jquery-load-extension-to-indicate-loading-and-errors $.fn.responsiveLoad = function(url, callback){ var loading = ''; var $container = $(this); $container.html(loading).load(url, function(response, status, xhr){ if (status == "error") { $container.html("Error:" + xhr.status + " " + xhr.statusText); } else { if(callback) callback(response, status, xhr); } }); };
Tagged: Javascript, jQuery, JS
