Some ajax loading callback.

This commit is contained in:
benni 2011-06-20 00:48:05 +02:00
parent b3c64ecb85
commit 8141c06fa5

View file

@ -66,6 +66,20 @@ $(function() {
$.getScript($(this).attr('href')); $.getScript($(this).attr('href'));
return false; return false;
}); });
// Show and hide loader on ajax callbacks
$('*[data-remote]').bind('ajax:beforeSend', function() {
$('#loader').show();
});
$('*[data-remote]').bind('ajax:complete', function() {
$('#loader').hide();
});
// Disable submit button on ajax forms
$('form[data-remote]').bind('ajax:beforeSend', function() {
$(this).children('input[type="submit"]').attr('disabled', 'disabled');
});
}); });