jquery - Scripts in _layout (MVC) -


all scripts worked fine when had view. , when tried split layout , partial view - scripts no longer worked. please answer questions:

1) links should placed? in view or in _layout? if in layout, should use

@scripts.render() 

or just

<script src="~/scripts/jquery-1.7.1.js"></script> 

2) scripts should placed? in view or in _layout? in head or inside body?

or can this: place scripts in view in

@section scripts{ }  

and in layout use

@rendersection("scripts", false) 

??

sorry silly questions :)

you can following in _layout.cshtml

@scripts.render("~/bundles/bundlename")

where bundlename name of bundle when call registerbundles. alternatively, can following:

@rendersection("scripts", required: false)

also, performance place js bundles @ bottom of page.


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -