From 4d207cde2dc224aeede630de64c2e939010851c7 Mon Sep 17 00:00:00 2001 From: Guillaume Mazoyer Date: Tue, 5 Aug 2014 11:01:57 +0200 Subject: Don't use AJAX global events, use local events only. --- js/looking-glass.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'js') diff --git a/js/looking-glass.js b/js/looking-glass.js index a58d114..d510ca0 100644 --- a/js/looking-glass.js +++ b/js/looking-glass.js @@ -4,17 +4,6 @@ $(document).ready(function() { $('.loading').hide(); $('.alert').hide(); - // show and hide loading bar - $(document).ajaxStart(function() { - $('#command_properties').attr('disabled', ''); - $('.alert').hide(); - $('.loading').show(); - }); - $(document).ajaxStop(function() { - $('#command_properties').removeAttr('disabled'); - $('.loading').hide(); - }); - // close the alert bar $('.close').click(function() { $('.alert').slideUp(); @@ -36,7 +25,18 @@ $(document).ready(function() { $.ajax({ type: 'post', url: 'execute.php', - data: $('form').serialize() + data: $('form').serialize(), + beforeSend: function() { + // show loading bar + $('#command_properties').attr('disabled', ''); + $('.alert').hide(); + $('.loading').show(); + }, + complete: function() { + // hide loading bar + $('#command_properties').removeAttr('disabled'); + $('.loading').hide(); + } }).done(function(response) { var response = $.parseJSON(response); -- cgit v1.2.3