473,394 Members | 1,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 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 26398
dev7060
636 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

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

Similar topics

2
by: qaz | last post by:
I have login links on a number of pages in my site. Some of the pages expect variables on the querystring. I want to be able to login from any of these pages. The login link redirects me to a...
4
by: Chad Richardson | last post by:
As I'm writing this I think I am answering my own question, but I'd like to get any other ideas on the subject as well. I have a standard Header.asp that I want to include in every other page in...
5
by: mg | last post by:
Is there a simple way to determine the name & path of the Web page that calls a WebForm when the calling page is another type such as an html, jsp, or .do file.
3
by: MattB | last post by:
I have a UserControl that I use as a page header for my app. I want it to vary depending on what page it's being called by. In the CodeBehind, how to I refer to the calling page? Thanks! -- ...
1
by: JezB | last post by:
Within some library class, is there a way I can I determine which webpage called it, without having to pass in the calling Page object ? I only need the page name rather than the Page object. ...
2
by: Harold | last post by:
I have page A with form field and a button and when button is clicked it opens page B in another window. Page B has a treeview control and that is all. When something is selected I want the page...
1
by: desmcc | last post by:
Hi, I am launching a modal dialog through the usual javascript (window.showmodaldialog). When the modal dialog is complete (ie user selects OK), the calling page then refreshes itself by setting...
0
by: jobs | last post by:
I have a page where users select from a bunch of gridviews, setting session variables and then hit an a New or Edit button which redirects them to a formview in edit or insert mode. While in...
2
by: eholz1 | last post by:
Hello PHP Group, I have a php page that calls another php page to load a image from a database (mysql) in to the calling page. It works like this: first_view.php has <img src="image.php?img=5"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.