I have implementation a j query date and time picker into a website. The picker is working and when i select a date and time it saves to a database. what i can not figure out how to do is disable any date and times which are in the database, so that no one can select a time on a date which has previously been selected. This is my code for the jquery picker, searching the database for the valus isnt a problem im just not sure how to set it in the picker itself:
<script type="text/javascript">
$(function(){
$('*[name=date2]').appendDtpicker({"inline": true,
"allowWdays": [1, 2, 3, 4, 5], // 0: Sun, 1: Mon, 2: Tue, 3: Wed, 4: Thr, 5: Fri, 6: Sat
"futureOnly": true,
"autodateOnStart": false
});
$('#btn_input').on('click', function(){
var input = $('*[name=date2]').handleDtpicker('getDate');
var select = document.getElementById("doctor").value;
var select1 = document.getElementById("patient").value;
console.log(input);
$.post( "backend2.php", {
'input':input,
'select':select,
'select1':select1
}).done(function( data ) {
alert( "You have selected" + data );
});
});
});
</script>