Link a javascript file to a template

Posted 3 months ago by successdav

Thanks for reading, Yep this may sound funny but I have spend 5hrs trying to solve this problem.

I setup a new project

create a inside: resources/views/projects/create.blade.php

and I link it to the javascript file on: public/js/app.js

on my app.js file I write alert('Hello World') // I want to be sure the javascript file is connected

then on my create.blade.php file i have used the following code to link the js file

<script src="js/app.js'"></script> // This dint work

<script src="{{ asset('js/app.js') }}"></script>  // this still dint work 

<script src="{{'../../../public/js/app.js') }}"></script>  // did not work either

None of this code worked because the alert('hello world') does not run when the view the page on my browser

This thing is driving me crazy

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.