I need the help of a jquery guru :)
I'm trying to teach myself some javascript (bootstrap datepicker), but I'm failing because of the following:
I am currently reading the blocked days (json format) from a file use it as blocked dates in my datepicker, it works great:
javascript code:
$("#picker1").datepicker({
autoclose: true,
updateViewDate: false,
daysOfWeekDisabled: [0,6],
startDate: '+1d'
}).on('show', function(e) {
var setid = 12;
var pickedMonth = new Date(e.date).getMonth() + 1;
var pickedYear = new Date(e.date).getFullYear();
$.ajax({
url: 'get_block_date.php',
data:'sid='+ setid + '&m='+pickedMonth+'&y='+pickedYear,
dataType: 'JSON',
type: 'POST'
})
.done(function( response ) {
$('#picker1').datepicker("setDatesDisabled", response.disableDates);
})
.fail(function(response, jqxhr, textStatus, error) {
$('#picker1').datepicker('remove');
alert('loading blockeddates failed');
});
}).on('changeMonth', function (e) {
}).on('changeDate', function(e) {
});
the json looks like this:
[ "2021-09-30", "2021-10-01", "2021-10-02", "2021-10-03", "2021-10-04" ]
my question:
now I would like to turn it around:
I have a new json file in which the days are listed which should be the only ones activated AND i have a separator next to the date for an special id. if the dates is chosen, the id should be able to be processed.
my json file:
[ "2021-09-29|2", "2021-09-28|3", "2021-09-27|2" ]
my task:
hope you help me ;) Thanks!