In this case you can use requests Ajax, I believe that would be the only option for your case. To facilitate the work use the library jQuery. Assuming you’ve already included the library on your page, let’s take a few examples:
To run an external PHP code:
$.get( "test.php" );
If you need to pass some parameter to the script:
$.get( "test.php", { name: "John", time: "2pm" } );
In case you need to pick up any returns:
$.get( "test.php", function( data ) {
alert( "Retorno: " + data );
});
the jQuery.get() or $.get() amounts to jQuery.ajax() or $.ajax() in terms of operation, however, it would be "but" simple to use. Documentation: https://api.jquery.com/jquery.get/
Beyond the $.get() you can choose to $.ajax() as listed above, if you need more resources. Documentation: https://api.jquery.com/jQuery.ajax/
You know Ajax???
– Bsalvo
This is the problem, I saw some examples of AJAX but I did not find it very convenient, since I have little use for it in my application, until now it would only be this in the case. I have enough difficulty with scripts, I would like something to escape from AJAX, if it is really the only option I will try to implement it again.
– Wel
You say in your question that a Reload is unwanted, ajax will solve your problem in relation to that. Stay calm regarding the difficulty, it is simpler than it seems that you can be sure.
– Bsalvo
If you want an example in ajax, I can give an answer with the use of it, I can also explain in a simple but understanding way and you will see that it is a very simple thing.
– Bsalvo
Remembering that php is server-side, this means it will run on the server and then come as a result on the page. I don’t know another simple way to do this execution if not with Ajax.
– Bsalvo