I am getting dates via ajax. And I want to disable those dates on my datepicker. But the parameter datesDisabled is not working in my code at all. It always shows the datepicker without disable any date. Below is my jquery code:
$(document).ready(function() {
$("#people").blur(function() {
var people = $("#people").val();
if(people == "" || people == 0)
{
$("#people-error").html("Please enter number of people.");
return false;
}
var experience_uid = $("#experience_uid").val();
var req_url = "' . site_url() . '/wp-content/plugins/visitnorth/visitnorth.php";
var ajax_req_for_schedule = 1;
$.ajax({
async:false,
"type": "POST",
"url": req_url,
"data": {"people":people, "experience_uid":experience_uid, "ajax_req_for_schedule":ajax_req_for_schedule},
statusCode: {
404: function() {
alert("Oj, någonting gick fel. Försök igen.");
},
500: function() {
alert("Oops! An Internal Error has occurred.");
},
},
success: function (data) {
//output data is: ["11-08-2017, 11-05-2017, 11-03-2017"]
$(".datepicker").datepicker({
todayHighlight: true,
datesDisabled: data
});
}
});
});
});