我有一个页面,其中包含一个带有链接的菜单侧边栏和一个 div,从其中的其他页面加载 ajax 内容,内容加载成功,但脚本和 css 不起作用,而且我已经使用 html 5 历史加载从其他页面加载内容。
$(function () {
    $('.menuAnchor').click(function (e) {
        href = $(this).attr("href");
        loadContent(href);
        // HISTORY.PUSHSTATE
        history.pushState('', 'New URL: ' + href, href);
        e.preventDefault();
    });
    // THIS EVENT MAKES SURE THAT THE BACK/FORWARD BUTTONS WORK AS WELL
    window.onpopstate = function (event) {
        console.log("pathname: " + location.pathname);
        loadContent(location.pathname);
    };
});
function loadContent(url) {
    // USES JQUERY TO LOAD THE CONTENT
    $.get(url, {}, function (data) {
        $(".contn_btm_mid_bg").html($(data).find('.contn_btm_mid_bg').html());
        //$.validator.unobtrusive.parse(".contn_btm_mid_bg");
    });
    // THESE TWO LINES JUST MAKE SURE THAT THE NAV BAR REFLECTS THE CURRENT URL
    $('li').removeClass('current');
    $('a[href="' + url + '"]').parent().addClass('current');
}