I developed a function that does almost exactly what I needed:
View code: Example 1
But in the last part where it makes me "view" (document.getElementById('showResult')) only the result, I need to do it in a way that instead calls me another PHP page, where it will execute the instructions passed in this page.
Code used:
Expand|Select|Wrap|Line Numbers
- //Example 1
- function getCheckedValues()
- {
- return Array.from(document.querySelectorAll('input[type="checkbox"]'))
- .filter((checkbox) => checkbox.checked)
- .map((checkbox) => checkbox.value);
- }
- const resultEl = document.getElementById('result');
- document.getElementById('showResult').addEventListener('click', () =>{
- resultEl.innerHTML = getCheckedValues();
- });
Expand|Select|Wrap|Line Numbers
- //Link that should I call through the function:
- <p>
- https://localhost.test:8085/live/backofficeNew/Tests/controller/sendToPhysicianSampleID.php?idList=BIY53423 </p>