472,146 Members | 1,267 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,146 software developers and data experts.

Calling a PHP page through Javascript

4
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.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
  1. //Example 1
  2.  
  3. function getCheckedValues() 
  4.             {
  5.                 return Array.from(document.querySelectorAll('input[type="checkbox"]'))
  6.                         .filter((checkbox) => checkbox.checked)
  7.                         .map((checkbox) => checkbox.value);
  8.                 }
  9.  
  10.                 const resultEl = document.getElementById('result');
  11.  
  12.                         document.getElementById('showResult').addEventListener('click', () =>{
  13.                         resultEl.innerHTML = getCheckedValues();
  14.  
  15. });
  16.  
Expand|Select|Wrap|Line Numbers
  1. //Link that should I call through the function:
  2.  
  3. <p>
  4. https://localhost.test:8085/live/backofficeNew/Tests/controller/sendToPhysicianSampleID.php?idList=BIY53423 </p>
  5.  
Dec 9 '21 #1
2 25061
dev7060
624 Expert 512MB
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.getElementById('showResult')) 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?
Dec 23 '21 #2
Abfd
2 2Bits
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/
Nov 14 '22 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by mg | last post: by
3 posts views Thread by MattB | last post: by
2 posts views Thread by Harold | last post: by
1 post views Thread by desmcc | last post: by
reply views Thread by Saiars | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.