Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

137
Vistas
Not able to put/get value from session during Ajax request in Laravel 8

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.

  1. I'm using jQuery to make ajax calls, Both the ajax request use post method.
  2. My routes are in web.php
  3. I've checked the session id in both request it's the same. The code for getting and setting session data is in same controller file.
  4. I'm using database as a session driver.

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.

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda