Javascript DropDownList在选择时显示不同的数据表,其中的标题和旧数据被弄乱

Javascript DropDownList在选择时显示不同的数据表,其中的标题和旧数据被弄乱,javascript,jquery,datatables,jquery-datatables,Javascript,Jquery,Datatables,Jquery Datatables,我有一个下拉列表。当用户从下拉列表中选择值时,将显示datatables。我只能使第一个表正确显示,从下拉列表中选择的后续内容将使标题和值的顺序混乱。以前datatables中的某些标题仍位于新datatables标题上。造型不见了。如果我单击某个列进行排序,样式将恢复,但标题和正文仍然有错误的数据 我的密码 <script type="text/javascript"> $(document).ready(function () { //$('#compTa

我有一个下拉列表。当用户从下拉列表中选择值时,将显示datatables。我只能使第一个表正确显示,从下拉列表中选择的后续内容将使标题和值的顺序混乱。以前datatables中的某些标题仍位于新datatables标题上。造型不见了。如果我单击某个列进行排序,样式将恢复,但标题和正文仍然有错误的数据

我的密码

<script type="text/javascript">
    $(document).ready(function () {
        //$('#compTable').remove(); //tried this but nothing loads.
        $('.ddlCom').change(function () {

            var comID = $(this).val();
            $.ajax({
                "url": 'CompTableJson.ashx?comID=' + comID,
                "dataType": "json",
                "success": function (json) {
                    $('#compTable').dataTable({
                        "aaData": json.aaData,
                        "aoColumns": json.aoColumns,
                        "aaSorting": [[0, "desc"]],
                        "bJQueryUI": true,
                        "bScrollInfinite": true,
                        "bScrollCollapse": true,
                        "bDestroy": true,
                        "bDeferRender": true,
                        "iDisplayLength": 100,
                        "sScrollY": "1000px"
                    });
                }

            });
        });

    });    

</script>

Nvm,我知道了。我不仅要销毁数据表,还要清除所有的HTML