Reputation: 3
I am sure there is a very simple answer to this question, I think am just having trouble. I have animation.js file. It also has a include folder with dependency_1.js and dependency_2.js. In my animation.js file I do load dependency_1.js and dependency_2.js relative to my animation.js file.
In my _Layout.cshtml file I do have:
@RenderSection("JavaScript", required: false)
And I did place within my view SomeView.cshtml
@section JavaScript
{
<script type="text/javascript" src="@Url.Content("~/Scripts/animation.js")"</script> }
But when my animate.js file calls the dependency_1.js file I get a 404 Not Found - http://localhost:14611/includes/dependency_1.js"
Im guessing it has to do with the url routing to the Scripts folder in my MVC project?
Upvotes: 0
Views: 749
Reputation: 887275
Relative paths in Javascript files are relative to the HTML page, not the source Javascript.
You need to use an absolute path.
Upvotes: 1