Q:

Add CSS and JS in AJAX-loaded PartialView

I found many answers about similar topics but all refers to PartialViews loaded not by AJAX where solutions are e.g. HtmlHelpers or Head section, but it doesn't work when I load PartialView by AJAX. 
I wanna add CSS stylesheet and JS script inside AJAX-loaded PartialView. Now I coded it inside PartialView and it works but it's not good solution (include scripts and stylesheets inside body).

A:

I didn't know that earlier that using script tag inside body is not evil. So it's not that bad I thought at first.
I implemented two functions in cssLink.js which I include in head:
/// <reference path="../jquery-1.4.4.js" />

function addCssLink(link) {
    var _cssLink = '<link rel=\"stylesheet\" href=\"' + link + '\" type=\"text/css\" />';
    $head = $('head');
    $link = $('link[href=' + link + ']', $head);
    if ($link.length == 0) {
        $head.append(_cssLink);
    }
}

function removeCssLink(link) {
    $('head link[href=' + link + ']').remove();
}

and I use those functions within PartialViews:
<script type="text/javascript">
    $(document).ready(function () {
        $('#sideMenu').tabs('#content', '#content > *');
        addCssLink('/Content/SideMenu.css');
    });
</script>

<script type="text/javascript">
    $(document).ready(function () {
        removeCssLink('/Content/SideMenu.css');
    });
</script>

Thank you guys for help, I think that informations about validation should be helpful for me later :)

