Add .JS in Homepage

3 years ago
Hi, I'm new with this NopCommerce, and I'm just testing to see how it works.

I'm trying to add this code in the Index.cshtml, but nothing changed.

Somebody can give me a hint please?

Html.AddScriptParts("~/Themes/DefaultClean/Scripts/js/curvedLines.js");
    Html.AddScriptParts("~/Themes/DefaultClean/Scripts/js/excanvas.min.js");
    Html.AddScriptParts("~/Themes/DefaultClean/Scripts/js/jquery.colorhelpers.js");
    Html.AddScriptParts("~/Themes/DefaultClean/Scripts/js/jquery.flot.canvas.js");
    Html.AddScriptParts("~/Themes/DefaultClean/Scripts/js/jquery.flot.categories.js");
    Html.AddScriptParts("~/Themes/DefaultClean/Scripts/js/jquery.flot.crosshair.js");
    Html.AddScriptParts("~/Themes/DefaultClean/Scripts/js/jquery.flot.errorbars.js");
    Html.AddScriptParts("~/Themes/DefaultClean/Scripts/js/jquery.flot.fillbetween.js");
    Html.AddScriptParts("~/Themes/DefaultClean/Scripts/js/jquery.flot.image.js");
    Html.AddScriptParts("~/Themes/DefaultClean/Scripts/js/jquery.flot.js");
    Html.AddScriptParts("~/Themes/DefaultClean/Scripts/js/jquery.flot.navigate.js");
    Html.AddScriptParts("~/Themes/DefaultClean/Scripts/js/jquery.flot.pie.js");
    Html.AddScriptParts("~/Themes/DefaultClean/Scripts/js/jquery.flot.resize.js");
    Html.AddScriptParts("~/Themes/DefaultClean/Scripts/js/jquery.flot.selection.js");
    Html.AddScriptParts("~/Themes/DefaultClean/Scripts/js/jquery.flot.spline.js");
    Html.AddScriptParts("~/Themes/DefaultClean/Scripts/js/jquery.flot.stack.js");
    Html.AddScriptParts("~/Themes/DefaultClean/Scripts/js/jquery.flot.symbol.js");
    Html.AddScriptParts("~/Themes/DefaultClean/Scripts/js/jquery.flot.threshold.js");
    Html.AddScriptParts("~/Themes/DefaultClean/Scripts/js/jquery.flot.time.js");
    Html.AddScriptParts("~/Themes/DefaultClean/Scripts/js/jquery.flot.tooltip.min.js");

<div id="flot-dashboard-chart"></div>

@section Scripts{
    <script type="text/javascript">
        $(document).ready(function () {

            //#Code for the chart#

            $.plot($("#flot-dashboard-chart"), dataset, options);
        });
    </script>
}
3 years ago
I'm also a newbie.

Try _Root.Head.cshtml from Nop.Web/Views/Shared ?
3 years ago
Yes...  /Views/Shared/_Root.Head.cshtml  is probably your best option.