I'm using the Play Framework and am trying to define a javascript file within a function in another javascript file (the reason being that I don't want these functions to be usable outside of the container function).
So I have two javascripts files, ./public/javascripts/main.js, ./public/javascript/custom.js.
From my html pages (index.scala.html) I define this as follows:
<script src="@routes.Assets.at("javascripts/main.js")"></script>
Using "@routes...." doesn't work in main.js, so I tried adding the following:
$.getScript("public/javascripts/custom.js", function(){
alert("Script loaded and executed.");
});
I've tried a variety of paths but it always says it can't find it.
Any idea how to do this in Play please? Looked through as much documentation as I can and nothing is there...
Any help would be brilliant!
Thank you.
Kind Regards,
Gary Shergill