I have created a function and call this function in select input inside another ajex file, when ajex is calling then and I want to get option value and set this value in API URL afteryour text
call function in ajex file
<select class="form-control m-bot15" name="trainer_name" onchange="show()" id='select' required>
<option value="">Select Trainer</option>
<option value="5">Select Trainer</option>
<option value="6">Select Trainer</option>
</select>
let initialize = true;
let select = document.getElementById('select')
let list = [];
abcd();
select.addEventListener('change',function(){
abcd()
})
// console.log(abcd());
function abcd(){
fetch(`apu_url=${select.value}`)
.then(res => res.json())
.then(data => list = data)
.finally(show)
}
function show() {
let dates = list.filter(d => d.trainerid == select.value).map(e=>e.date_dmy_for)
let config = {
multidate: true,
startDate: new Date(),
minDate: new Date(),
weekStart: 1,
format: 'dd-M-yyyy',
//daysOfWeekHighlighted: "0,6",
language: 'en',
bound: false,
//daysOfWeekDisabled: [0, 6],
beforeShowDay: function (date) {
dmy = date.getDate() + "-" + (date.getMonth() + 1) + "-" + date.getFullYear();
var search_index = $.inArray(dmy, dates);
if (search_index > -1) {
return { classes: 'non-highlighted-cal-dates', tooltip: 'student have batch on this day.' };
} else {
return { classes: '', tooltip: 'student available on this day.' };
}
}
}
if(!initialize) $('.date').datepicker("destroy");
$('.date').datepicker(config);
initialize = false;
}
I want to when ajex file is calling then I select option value calendar data change accoring to option value