Reputation: 111
I am using laravel
I have one layout file called admin in which i have some external files addes like
below this files are in public directory
<script type="text/javascript" src="plugins/jquery.js"></script>
<script type="text/javascript" src="plugins/plugins.js"></script>
<script type="text/javascript" src="plugins/main.js"></script>
Now i have two view one post and other is allpost
and route for each layout is like this
/posts for post view
/posts/1 for allposts view
Now when i load frst view everything workd fine it loads all the external dependancies
http://Myserver.com/plugins/jquery.js path for local file is correct
but when i load second view which is for particular post whith post id it can't load external files because it requires different path to load files like
http://Myserver.com/posts/plugins/jquery.js"
so how can i solve this problem so i can use same layout for both view.
thanks in advance, really appreciated.
Upvotes: 0
Views: 661
Reputation: 746
Try add root slash in the beginning of js url:
<script type="text/javascript" src="/plugins/jquery.js"></script>
Upvotes: 1