array( 'Authorization' => 'Bearer ' . $token, 'user-agent' => 'Wordpress Plugin', 'Content-Type' => 'application/json;charset=utf-8', ), 'sslverify' => true, ) ); if (is_wp_error($response)) { wp_send_json_error('Unable to fetch data from Canto', 500); } $body = wp_remote_retrieve_body($response); wp_send_json_success($body); } add_action('wp_ajax_canto_detail', 'canto_handle_detail');