Reputation: 357
I have a simple .blade.php view for a Laravel application, I'm trying to include a JS file, which is in /public/js directory in my project.
<!DOCTYPE HTML>
<script src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript" src="{{ URL::asset('js/chartkick.js') }}"></script>
<html>
<body>
<div id="chart-1" style="height: 300px"></div>
<script>
new Chartkick.LineChart("chart-1", {"2013-02-10 00:00:00 -0800": 11, "2013-02-11 00:00:00 -0800": 6})
</script>
</body>
</html>
It looks like this, but when I try to display this I get
test:8 Uncaught ReferenceError: Chartkick is not defined
at test:8
In Chrome developer console, the JS file doesn't seems to be properly included in my project. Why?
Thanks for helping.
EDIT :
Here's the file structure
public
├── css
│ └── app.css
├── favicon.ico
├── js
│ ├── app.js
│ └── chartkick.js
├── robots.txt
└── web.config
Upvotes: 1
Views: 1834
Reputation: 66
Can you change this
URL::asset('js/chartkick.js')
to
URL::asset('/js/chartkick.js')
Upvotes: 0