Skip to content

Instantly share code, notes, and snippets.

@unoframille
Created August 18, 2017 16:10
Show Gist options
  • Save unoframille/d75f7b289a184e2fdeb662bf2cf0888b to your computer and use it in GitHub Desktop.
Save unoframille/d75f7b289a184e2fdeb662bf2cf0888b to your computer and use it in GitHub Desktop.
function checkAvailability() {
var dataLezione = $("#dateTime").val();
var start = $('#oraInizio').val();
var end = $("#oraFine").val();
$.post("ajax/stanze/availability.php", {
'start': dataLezione + ' ' + start,
'end': dataLezione + ' ' + end
}).done(function(json) {
var result = jQuery.parseJSON(json);
$('.select option').attr('disabled', false);
$.each(result, function(index, value){
console.log('stanza ' + value.id_stanza + ' -- insegnante ' + value.id_insegnante)
$('#select-room-'+value.id_stanza).attr('disabled', 'disabled');
$('#select-teacher-'+value.id_insegnante).attr('disabled', 'disabled');
});
$('#nuovo-stanza-lezione').select2('destroy').select2().val('').change();;
$('#nuovo-insegnante-lezione').select2('destroy').select2().val('').change();;
console.log('--------');
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment