I am finding way to get data JSON from PHP file without knowing the function PHP file is processing.
<script>
function clickButton(){
var s = document.createElement("script");
s.src = "jsonp_demo_db.php?callback=myDisplayFunction";
document.body.appendChild(s);
}
</script>
send the function name with get request and check if is Get value exist and use call_user_func($functionName)
and if there is parameter with function you can use call_user_func_array($functionName , $pramaters)
`function test()
{
echo "string";
}
if ($_GET['func']) {
$func = $_GET['func'];
call_user_func($func);
}`
you can also use function_exists to enshure if the function exist and this function return False or True this code Example :
if(function_exists('my_function'))
{
throw new Exception("'my_function' is already defined!");
}
function my_function()
{
// Do the work here
}