Thanks for your reply.
It works, but as I do a query in ajax so is_admin() return true ..
I added a test for checking if I use admin-ajax.php :
function detecting_is_front_ajax()
{
$test_url = basename($_SERVER['REQUEST_URI']);
return str_contains($test_url, 'admin-ajax.php');
}