I have a list of dates stored in a MYSQL table, the idea is that the next value of the "completed" field in the date string is not selected in the jQueryUI datepicker. Dates are stored in the format YYYY-MM-DD .. how can I load these "completed" dates into a PHP array in a format that a date picker can understand and disable? JSON would be the obvious answer, I have spent the last couple of weeks to handle this. Any jquery / php code code would be greatly appreciated.
Thank you very much in advance.
[I did research on this subject, but it is not particularly well documented. I already have a date picker showing valid days per week. It seems that jqueryUI datepicker is capable of doing everything except making a cup of tea. ]
EDIT: Thus, I managed to pass an array of dates with the “final” status using JSON, I thought I would provide the code if it helps someone:
<?php
include('functions.php');
connectLocal($localcon);
$result = mysql_query("SELECT sendDate FROM my_table WHERE status='final'");
$i=0;
while($row = mysql_fetch_array($result))
{
$confirmedSends[$i] = array ( "sendDate" => $row['sendDate']);
$i++;
}
header('Content-type: application/json');
$jsonConfirmedSends = json_encode($confirmedSends);
echo $jsonConfirmedSends;
?>
This can be obtained using json as a list of dates. A warning field appears once for each date. About working on representing them in my datepicker array.
$.getJSON("get-disabled-dates.php",
function(data){
$.each(data, function(index, completed) {
alert(completed.sendDate);
});
});
source
share