I'm trying to add a chart in my Laravel frontend application.
require('./horizBarChart');
@import 'horizBarChart.scss';
Now, after compiling I see that the horizBarChart function is included in my app.js generated file:
But when opening the website I still get funtion not found error:
If I dont use require but include it as basic <script src="../jquery.horizBarChart.min.js"></script>
all works fine.
What am I doing wrong here?
link
tag in HTML is used for css, for scripts
it should be:
<script src="/js/app.js"></script>
And also I think you should put this line below jQuery, not above as I see the library also uses jQuery, so make sure that jQuery is loaded first.
JS file "app.js"
You've included in Style/CSS/Link Tag, You need to include in Script Tag:
For Javascript:
<script type="text/javascript" src="{{ URL::asset('js/app.js') }}"></script>
Make your directory structure is like this for JS: /public/js/app.js
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.