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

593
Views
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 answers
Answer question

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 Report
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!