I\'ve read all the topics about my question but cannot solve my problem. I want to get php function result using jQuery AJAX.
function.php
function g
What I do is in JavaScript I pass PHP function name which I want to call. Like..
function MyFunction() {
jQuery.ajax({
type: "GET",
url: "function.php",
data: "call=generateCode",
success: function(response){
//do something
});
}
Here in data field "call" variable have function name to call from "function.php" file.
in "function.php" I place below code to call the function
if($_SERVER['REQUEST_METHOD']=="GET") {
$function = $_GET['call'];
if(function_exists($function)) {
call_user_func($function);
} else {
echo 'Function Not Exists!!';
}
}