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

119
Vistas
add php {{--php code--}} to laravel blade using javascript

There is a laravel project I'm working on, in which I have to retrieve data from database and then show it to the users. the thing is I have some pre-built components in javascript and the data needs to be inside of it. an example would be:

    var element = ` <div class="col-12 p-4 d-flex flex-column">
                      <h3 class="text-white">
                        {{$user_data->data}}
                      </h3>
                      <div class="bg-white p-3 rounded">
                        <p class="mb-0">
                        {{$user_data->data}}
                        </p>
                      </div>
                    </div>`;

and then I would add this element div to the blades body in my js file. the problem is that the php tags are working like strings so what I get instead of users data in the page is {{$user_data->data}}. Can anyone help me how to fix that?

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