From 15d181d577c6ef818bd59871178f7ad6d6ceafc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xe=CC=81fir=20Destiny?= Date: Fri, 25 Oct 2013 17:21:34 +0200 Subject: [PATCH] =?UTF-8?q?D=C3=A9sactivation=20pour=20=C3=A9viter=20le=20?= =?UTF-8?q?double=20clic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/app.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/js/app.js b/js/app.js index 39ba094..013210b 100644 --- a/js/app.js +++ b/js/app.js @@ -17,6 +17,11 @@ function callRequest(action, section, message) { label.classList.add('label-warning'); label.innerHTML = 'Loading'; + var buttons = document.querySelectorAll('#' + section + ' button'); + for (var button in buttons) { + buttons[button].disabled = true; + } + var xhr = new XMLHttpRequest(); xhr.open('POST', 'ajax.php'); xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); @@ -34,6 +39,11 @@ function callRequest(action, section, message) { label.classList.add('label-success'); label.innerHTML = 'OK'; } + + for (var button in buttons) { + buttons[button].disabled = false; + } + document.querySelector('#' + section + ' input').value = ''; } }; }