Reputation: 145
This is the javascript source in blade file.
<script src="{{ URL::to('resources/views/template/js/jquery-3.3.1.min.js') }}"></script>
OR
<script src="{{ asset('resources/views/template/validate/jquery.bvalidator.min.js') }}"></script>
Both asset and URL::to doesn't work. The actual file path is: resources -> views -> template -> js
error shows 404 not found on local xampp server. its working fine in production. project is copy of production code.
I would appreciate for your kind support. thanks
Upvotes: 2
Views: 6258
Reputation: 1079
The standard way to store files is in Public folder of Project. Place your files within a folder in Public folder.
Like public/assets/folder
You can access it by following.
<script src="{{ asset('assets/folder/jquery.js') }}"></script>
asset() helper by defualt hit in public folder of Project.
Upvotes: 1
Reputation: 575
Static assets are usually stored in the public
folder in Laravel. It would be wise to store all your JavaScript files in a separate folder inside the public folder, e.g. public/js/
.
You could then access your files with the asset()
function call, for example:
<script src="{{ asset('js/jquery.bvalidator.min.js') }}"></script>
Upvotes: 5