Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

248
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda