Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

252
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!