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

591
Vistas
How to calling javascriprt function in laravel blade after mix

in here i have stuck mind and cannot found how to solve this

i have a file app.js & form.js

in app.js i have some code like:

require('bootsrap');
require('./form.js');

in form.js i have function code like:

function saveform(somevariable) {
 // some code
}

then mix that app.js file

after that i'm call saveform(somevariable) function into laravel blade file lets we call as form.blade.php

<html>
 <head></head>
 <body>

  <script>
   var somvariable = 'some attribute';
   
   saveform(somevariable);
  </script>

  <script src="{{ mix('js/app.js') }}"></script>
 </body>
</html>

and i have and error like this in browser

ReferenceError: tinymceInit is not defined
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Use window

in app.js

require('bootsrap');
window.form = require('./form.js');

in form.js

export function saveform(somevariable) {
 // some code
}

in form.blade.php

<html>
 <head></head>
 <body>
  <script src="{{ mix('js/app.js') }}"></script>
  <script>
   var somvariable = 'some attribute';
   
   window.form.saveform(somevariable);
  </script>
 </body>
</html>
about 4 years ago · Juan Pablo Isaza Denunciar
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