I know this question is 5 years old, but for anybody wondering how to do this without re-rendering the main page. This solution uses the dart editor/scripting language.
You could have an tag that contains a
data
attribute. Make the 1px by 1px and then use something like dart to
dynamically change the
's
data
attribute which re-renders the data
in the 1px by 1px object.
HTML Script:
Start Script
someScript.php:
dartScript.dart:
import 'dart:html';
InputElement button1;
ObjectElement externalSource;
void main[] {
button1 = querySelector['#button1']
..onClick.listen[runExternalSource];
externalSource = querySelector['#external_source'];
}
void runExternalSource[Event e] {
externalSource.setAttribute['data', 'someScript.php'];
}
So long as you aren't posting any information and you are just looking to run a script, this should work just fine.
Just build the dart script using "pub Build[generate JS]" and then upload the package onto your server.
View Discussion
Improve Article
Save Article
View Discussion
Improve Article
Save Article
Given a document containing HTML and PHP code and the task is to call the PHP function after clicking on the button. There are various methods to solve this problem. Also, apart from doing this with the click of a button, a PHP function can be called using Ajax, JavaScript, and JQuery. But this article mainly focuses on the button oriented approach of calling the PHP Function.
Calling a PHP function using the HTML button: Create an HTML form document which contains the HTML button. When the button is clicked the method POST is called. The POST method describes how to send data to the server. After clicking the button, the array_key_exists[] function called.
Program 1:
How to call PHP function
on the click of a Button ?
GeeksforGeeks
How to call PHP function
on the click of a Button ?
Output:
Let’s take a look with the GET or POST methods, as most developers use POST method due to privacy issues, the following example is based on POST method only:
Program 2: This program uses isset[] function to call PHP function.
How to call PHP function
on the click of a Button ?
GeeksforGeeks
How to call PHP function
on the click of a Button ?
Output: