Calling a PHP page through Javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • WIPE
    New Member
    • Oct 2021
    • 4

    Calling a PHP page through Javascript

    I must call a PHP page with a Javascript command.

    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.getEl ementById('show Result')) 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:

    Code:
    //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();
    
    });
    Code:
    //Link that should I call through the function:
    
    <p>
    https://localhost.test:8085/live/backofficeNew/Tests/controller/sendToPhysicianSampleID.php?idList=BIY53423 </p>
  • dev7060
    Recognized Expert Contributor
    • Mar 2017
    • 656

    #2
    I must call a PHP page with a Javascript command.

    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.getEl ementById('show Result')) only the result, I need to do it in a way that instead calls me another PHP page
    You may want to use Fetch API.

    where it will execute the instructions passed in this page.
    What are you referring to by instructions? URL params?

    Comment

    • Abfd
      Banned
      New Member
      • Nov 2022
      • 2

      #3
      I got the best questions that are in demand from JavaScript one of the most languages out there and if you can solve these questions you can get your job, but if you can't they provide you free courses step by step it depends on your level in order to become a programmer and good luck.. Learn more: https://javascript.spread.name/

      Comment

      Working...