164
rated 0 times
[
169]
[
5]
/ answers: 1 / hits: 15807
/ 9 Years ago, mon, october 26, 2015, 12:00:00
I want to be able to call external js file in mvc 5 _layout page, i have done a few researches on google, but no success, below is my code in the _Layout Head section:
<!-- start: MAIN JAVASCRIPTS -->
<!--[if lt IE 9]>
<script src=~/assets/plugins/respond.min.js></script>
<script src=~/assets/plugins/excanvas.min.js></script>
<script type=text/javascript src=~/assets/plugins/jQuery-lib/1.10.2/jquery.min.js></script>
<![endif]-->
<!--[if gte IE 9]><!-->
<script type=text/javascript [email protected](~/assets/plugins/jQuery-lib/2.0.3/jquery.min.js)></script>
<!--<![endif]-->
<script type=text/javascript [email protected](~/assets/plugins/jquery-ui/jquery-ui-1.10.2.custom.min.js)></script>
<script type=text/javascript [email protected](~/assets/plugins/bootstrap/js/bootstrap.min.js)></script>
<script type=text/javascript [email protected](~/assets/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js)></script>
<script type=text/javascript [email protected](~/assets/plugins/blockUI/jquery.blockUI.js)></script>
<script type=text/javascript [email protected](~/assets/plugins/iCheck/jquery.icheck.min.js)></script>
<!-- end: MAIN JAVASCRIPTS -->
<script>
jQuery(document).ready(function () {
Main.init();
Index.init();
});
</script>
@RenderSection(JavaScript, required : false)
@RenderSection(CSS, required : false)
Then at the bottom of the _Layout page i have this:
@Scripts.Render(~/bundles/jquery)
@Scripts.Render(~/bundles/bootstrap)
@Scripts.Render(~/bundles/assets/plugins)
@RenderSection(Scripts, required : false)
In the View, i have this:
@section JavaScript
{
<!-- start: JAVASCRIPTS REQUIRED FOR THIS PAGE ONLY -->
<script type=text/javascript [email protected](~/assets/plugins/flot/jquery.flot.js)></script>
<script type=text/javascript [email protected](~/assets/plugins/flot/jquery.flot.pie.js)></script>
<script type=text/javascript [email protected](~/assets/plugins/flot/jquery.flot.resize.min.js)></script>
<script type=text/javascript [email protected](~/assets/plugins/jquery.sparkline/jquery.sparkline.js)></script>
<script type=text/javascript [email protected](~/assets/plugins/jquery-easy-pie-chart/jquery.easy-pie-chart.js)></script>
<script type=text/javascript [email protected](~/assets/plugins/jquery-ui-touch-punch/jquery.ui.touch-punch.min.js)></script>
<script type=text/javascript [email protected](~/assets/plugins/fullcalendar/fullcalendar/fullcalendar.js)></script>
<script type=text/javascript [email protected](~/assets/js/index.js)>
</script>
<!-- end: JAVASCRIPTS REQUIRED FOR THIS PAGE ONLY -->
}
Please i will appreciate i someone could assist in suggesting what to do. thanks
More From » asp.net-mvc