Désactivation pour éviter le double clic

This commit is contained in:
Michel Roux 2013-10-25 17:21:34 +02:00
parent a94078632b
commit 15d181d577

View File

@ -17,6 +17,11 @@ function callRequest(action, section, message) {
label.classList.add('label-warning'); label.classList.add('label-warning');
label.innerHTML = 'Loading'; label.innerHTML = 'Loading';
var buttons = document.querySelectorAll('#' + section + ' button');
for (var button in buttons) {
buttons[button].disabled = true;
}
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open('POST', 'ajax.php'); xhr.open('POST', 'ajax.php');
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
@ -34,6 +39,11 @@ function callRequest(action, section, message) {
label.classList.add('label-success'); label.classList.add('label-success');
label.innerHTML = 'OK'; label.innerHTML = 'OK';
} }
for (var button in buttons) {
buttons[button].disabled = false;
}
document.querySelector('#' + section + ' input').value = '';
} }
}; };
} }