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

246
Vistas
Uncaught TypeError: Cannot read properties of null (reading 'content')

I need your help to solve this error, it appeared out of nowhere, it was working normally, and now I don't know why I get this error with the X-CSRF-TOKEN. My head:

<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="csrf-token" content="{{ csrf_token() }}">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">

My script:

<script>

  const csrfToken =  document.head.querySelector('meta[name="csrf-token"]').content;                
  document.getElementById('_categoria').addEventListener('change',(e)=>{
      fetch('subcategorias',{
          method : 'POST',
          body: JSON.stringify({texto : e.target.value}),
          headers:{
              'Content-Type': 'application/json',
              "X-CSRF-Token": csrfToken
          }
      }).then(response =>{
          return response.json()
      }).then( data =>{
          var opciones ="<option value=''>Elegir</option>";
          for (let i in data.lista) {
             opciones+= '<option value="'+data.lista[i].id+'">'+data.lista[i].nombre+'</option>';
          }
          document.getElementById("_subcategoria").innerHTML = opciones;
      }).catch(error =>console.error(error));
  })

  document.getElementById('_subcategoria').addEventListener('change',(e)=>{
      fetch('empresas',{
          method : 'POST',
          body: JSON.stringify({texto : e.target.value}),
          headers:{
              'Content-Type': 'application/json',
              "X-CSRF-Token": csrfToken
          }
      }).then(response =>{
          return response.json()
      }).then( data =>{
          var opciones ="<option value=''>Elegir</option>";
          for (let i in data.lista) {
             opciones+= '<option value="'+data.lista[i].id+'">'+data.lista[i].nombre+'</option>';
          }
          document.getElementById("_empresa").innerHTML = opciones;
      }).catch(error =>console.error(error));
  })

I clarify that the script is for dynamic selects of 3 levels.

about 4 years ago · Juan Pablo Isaza
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