Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 将默认页面样式应用于ajax调用返回的html_Jquery_Html_Css_Ajax_Datatables - Fatal编程技术网

Jquery 将默认页面样式应用于ajax调用返回的html

Jquery 将默认页面样式应用于ajax调用返回的html,jquery,html,css,ajax,datatables,Jquery,Html,Css,Ajax,Datatables,如何将视图中引用的默认css和jquery文件应用于jquery datatables fnRender属性中生成的HTML <script type="text/javascript"> $(document).ready(function () { $('#users-search-results').dataTable({ "bServerSide": true, "sAjaxSource": "UsersAjaxHandler",

如何将视图中引用的默认css和jquery文件应用于jquery datatables fnRender属性中生成的HTML

<script type="text/javascript">
$(document).ready(function () {
    $('#users-search-results').dataTable({
        "bServerSide": true,
        "sAjaxSource": "UsersAjaxHandler",
        "bProcessing": true,
        "aoColumns": [
                        { "sName": "NAME" },
                        { "sName": "REQUESTS_REMAINING" },
                        { "sName": "LAST_REQUEST" },
                        { "sName": "EMAIL" },
                        {
                            "sName": "UserId",
                            "bSearchable": false,
                            "bSortable": false,
                            "fnRender": function (oObj) {
                                @*//<script src="~/js/theme.js"></script>*@
                                // oObj.aData[0] returns the userId
                                return "<button class='btn glow'>Drop down</button>"
                        + "<button class='btn glow dropdown-toggle' data-toggle='dropdown'>"
                            + "<span class='caret'></span>"
                        + "</button>"
                        + "<ul class='dropdown-menu'>"
                            + "<li><a href='#'>Option one</a></li>"
                            + "<li><a href='#'>Option two</a></li>"
                            + "<li><a href='#'>Option three</a></li>"
                            + "<li><a href='#'>Option four</a></li>"
                        + "</ul>"
                    + "</div>";

                            }

                        }
        ]
    });
});

加载html时,它没有样式或功能。我已经尝试在fnRender属性的实际HTML代码中包含脚本和css声明,但没有成功。

为动态生成的内容设置内联样式。要获得功能,需要在生成内容后附加事件处理程序。尝试在上使用jQuery