Skip to content

Instantly share code, notes, and snippets.

@RimonEkjon
Forked from ozgun/ajax_loading.js
Created August 26, 2014 03:39
Show Gist options
  • Save RimonEkjon/8a32b97822ff357baed2 to your computer and use it in GitHub Desktop.
Save RimonEkjon/8a32b97822ff357baed2 to your computer and use it in GitHub Desktop.
$(document).ready(function() {
$(".ajax_request").bind('ajax:before', function(evt, status, data, xhr) {
showAjaxLoading();
});
$(".ajax_request").bind('ajax:complete', function(evt, status, data, xhr) {
hideAjaxLoading();
});
$(".disable_page").bind('ajax:before', function(evt, status, data, xhr) {
disable_page();
});
$(".disable_page").bind('ajax:complete', function(evt, status, data, xhr) {
enable_page();
});
$(".ajax_form").bind('ajax:before', function(evt, status, data, xhr) {
$(this).find('input[type=submit]').attr('disabled', 'disabled')
});
$(".ajax_form").bind('ajax:complete', function(evt, status, data, xhr) {
$(this).find('input[type=submit]').removeAttr('disabled')
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment