473,372 Members | 1,175 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,372 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 26367
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"...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?

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.