Good day, I have attempted to follow the post - “Returning Table Values from User Selection”. My APP does not make use of any forms, but I’ve found that the concepts regarding the use of the Fetch() method make sense for my APP.
<script>
selectAssignment = document.getElementById('assignments');
selectAssignment.addEventListener('change', onChange);
function onChange(e) {
let lastAssignmentSelected;
// Returns the text value of the selected Assignment.
lastAssignmentSelected = e.target.options[e.target.selectedIndex].text;
}
fetch(`http://localhost:8000/getfirstAssignmentSelected/${lastAssignemntSelected}`)
.then(function(res) {
return res.json();
})
.then(function(data) {
screening_results_reports = data.screening_results_reports;
ighid_12046 = data.ighid_12046;
ighid_12022 = data.ighid_12022;
amc_099 = data.amc_099;
sll_qHPV = data.sll_qHPV;
colpo_LEEP = data.colpo_LEEP;
clinical_admin_stocktake = data.clinical_admin_stocktake;
patient_scheduling = data.patient_scheduling;
//if (data.assignemnts === '________') console.log('True')
document.getElementById('assignments').innerHTML = data.screening_results_reports;
document.getElementById('assignments').innerHTML = ighid_12046;
document.getElementById('assignments').innerHTML = ighid_12022;
document.getElementById('assignments').innerHTML = amc_099;
document.getElementById('assignments').innerHTML = sll_qHPV;
document.getElementById('assignments').innerHTML = colpo_LEEP;
document.getElementById('assignments').innerHTML = clinical_admin_stocktake;
document.getElementById('assignments').innerHTML = patient_scheduling;
console.log('assignments:', lastAssignemntSelected)
})
.catch(function(err) {
console.log(err);
});
</script>
I would like the above script to allow me to access the “id” and field attributes to display fetched data from cell values (User Selections) in a separate HTML table.