We have two ajax request in same webpage.
In first Ajax request we put some value in the session against the key product_id.
$request->session()->put('product_id', 'value');
In second Ajax request we try to get value of product_id from session but it returns null or blank
$request->session()->get('product_id'); // Returns null
I'm able to retrieve the value of product_id from session if I try to get it just after putting it into session.
Can anyone please help me identify the issue as why I'm not able to retrieve product_id from session in second ajax call? Issue is not consistent on some pages.
IMPORTANT : Recently we have upgraded the Laravel version from 5.7 to 8.40. It's working fine in older version.