WordPress Admin ajax request return value with 0 when echo outside of the function

add_action('wp_ajax_ybr_client_results', 'ybr_client_results');
add_action( 'wp_ajax_nopriv_ybr_client_results', 'ybr_client_results' );

function ybr_client_results() {
    $client_details = $_POST[ 'client_details' ];
    return $client_details;
    die();
}
 echo ybr_client_results();

it returns value with 0. how to fix it.

Read more here: WordPress Admin ajax request return value with 0 when echo outside of the function

Leave a Reply

Your email address will not be published. Required fields are marked *