JavaScript - jQuery - PHP:在数据库中的datetimepicker中动态显示特定时间

I have a jQuery datetimepicker using xdsoft plugin. I want to display only specific hours/time that has been stored in my database(using php).

Example if I have values in my database:

'12:00', '13:00', '15:00', 
'17:00', '17:05', '17:20', '19:00', '20:00'

And this is my jQuery for datetimepicker:

$('#datetimepicker1').datetimepicker({
  formatDate:'Y/MMM/d',
  allowTimes:[
    '12:00', '13:00', '15:00', 
    '17:00', '17:05', '17:20', '19:00', '20:00'
  ],
});

My problem is I can't used a technique to get the time values from my database and integrate it to my jQuery. This is what I want:

allowTimes:[my time values in my database],

PLEASE HELP ME :'(

Thanks.,

You can wrap the datepicker in an ajax success callback:

$.ajax({
  method: 'GET',
  url: 'gettimes.php'
}).done(function(response){
  $('#datetimepicker1').datetimepicker({
  formatDate:'Y/MMM/d',
  allowTimes:[
     response //JSON STRING with allowed Times
   ]
  });
});