通过Javascript调用PHP页面
我必须使用一个Java脚本命令调用一个PHP页面.
我开发了一个几乎完全符合我需要的函数:
查看代码:示例1
但在最后一部分中,它使我"查看"(Docent.getElementByID('showResult'))唯一的结果,我需要这样做,它将调用另一个PHP页面,在那里它将执行在该页面中传递的指令.
使用的代码:
选择 | 换行 | 行号
- //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();
- });
选择 | 换行 | 行号
- //Link that should I call through the function:
- <p>
- https://localhost.test:8085/live/backofficeNew/Tests/controller/sendToPhysicianSampleID.php?idList=BIY53423 </p>