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

184
Vistas
PHP Laravel/Livewire Get data from controller to script JS in the HTML view

In a PHP Laravel project, I have a function showCurve($1, $2) (launched by a click in the page), which put data in a variable of the controller.

@foreach ($CurveLimI2T as $curve => $val)
<li><span class="caret" wire:click="showCurve('{{$val['id']}}', '{{3}}')">{{$val['name']}}`</span>

The controller line of work :

$this->dataListPointsMin = $tabFinal_Min;

With dd(), I can see the data in the variable at this point.

So in the view, I get this variable to make work and load the data to a chart via a script at the end of the page. But the variable was empty and nothing appear ..

<script><?php $dataMin = json_encode($this->dataListPointsMin, JSON_NUMERIC_CHECK);?>

I use the same method an another page and the data are in the $this->myvariable and i can get it and work.

The chart was on the same page than the click function showCurve().

Did I have forget anyhting ?

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