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
Advertisement
Answer
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>