Suppose you have the following folder configuration:
Any folder name 1
<
任意 Any folder name 2
<
任意 Any folder name 3
<
コント Controller name
<
InIndex.cshtml
<
In Index.js
By creating a RazorViewEngine in Application_Start on Global.asax.cs and registering the Index.cshtml location with the RazorViewEngine, we were able to view any location.
I would like to use Index.js from Index.cshtml in the above folder configuration example.
In Index.cshtml @section header
<script src="Index.js" type="text/javascript"></script>
I would like to know how to successfully deliver the external javascript file to the browser by describing
Thank you.
I solved myself.Rename Index.js to IndexJS.cshtml.
IndexJS.cshtml uses a script tag to enclose the javascript code.
Write @Html.Partial ("IndexJS") in Index.cshtml.
Images like #include in c language
The external javascript file is now available in any folder.
© 2024 OneMinuteCode. All rights reserved.