Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to add Javascritp/JQuery in laravel 7?

I am new to laravel. I have setup a project with Vue and tried to add jquery code in one of the blade page but I am seeing following error in console. Jquery is working fine but the error in console tells that I am not doing it the right way.

Vue warn]: Error compiling template:

Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as , as they will not be parsed.

331|
332|
333| | ^^^^^^^^ 334| function refresh(value) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 335| { | ^^^^^^^^^ 336| location.replace('jiras?status='+value); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 337| }

Can anyone help me that where should I add jquery/javascript code so that it doesn't show any error in the console.

like image 861
Sartaj Singh Avatar asked Dec 21 '25 01:12

Sartaj Singh


1 Answers

@extends('layout.app')

@section('content')

    <your-vue-component></your-vue-component>

@endsection

and inside layout/app.blade.php you can put jquery. Probably above the app.js file

like image 125
Daud khan Avatar answered Dec 23 '25 15:12

Daud khan