<?php
function ybr_client_results(){
$client_details = $_POST['client_details'];
die();
}
add_action('wp_ajax_ybr_client_results', 'ybr_client_results');
?>
How to echo this $client_details value outside of the function
Like this:
<?php
$client_details = "";
function ybr_client_results(){
$client_details = $_POST['client_details'];
die();
}
echo $client_details;
add_action('wp_ajax_ybr_client_results', 'ybr_client_results');
?>
You have to create variable outside of function, and in function you have to create same name variable with global.
<?php
$client_datails;
function ybr_client_results(){
global $client_details;
$client_details = $_POST['client_details'];
die();
}
add_action('wp_ajax_ybr_client_results', 'ybr_client_results');