I have DB mysql with column date_in and date_out
how to set datepicker to show available only dates from database mysql.
i have two inputs with datepicker
<input type="text" name="check_in_date" id="check_in" />
<input type="text" name="chek_out_date" id="check_out" />
for example i have check_in_dates = 10-05-2012, 13-05-2012, … , n.
and they must be only available to pick through jQuery.datepicker.
jQuery datepicker has a minDate and maxDate, so you can parse your max and min date from MYSQL and set calendar minDate and maxDate like:
In this case your calendar will show dates only in the region provided.
Hope this helps.
As per comments:
jQuery datepicker has beforeShowDay, so now you can have all the dates that are available in your database in an Array, then override beforeShowDay method while initializing the datepicker, check if the selected date is in the array or not, if not return else proceed.
Look here for code sample