Adding jQuery code to ASP.NET Boilerplate

前端 未结 2 1503
后悔当初
后悔当初 2021-01-26 05:00

I have a project using ASP.NET Boilerplate. I want to add more functionality by using jQuery.

I try to write a simple code such as (below) to the end of a page (such as

2条回答
  •  萌比男神i
    2021-01-26 05:30

    do what the others said, but use

    
    

    Also aspnet boilerplate does not use bundles or a

    @RenderSection("scripts", required: false)
    

    in it's layout.

    jquery is linked in the layout, so you must use the layout. The default _ViewStart.cshtml defines the _Layout.cshtml as the layout.

    To get the javascript in the scripts section from your cshtml pages (views) to render you must add the

    @RenderSection("scripts", required: false)
    

    to the _Layout.cshtml

提交回复
热议问题