ajax输出没有风格


ajax output has no style

我有一个索引文件,它有一个搜索表单。搜索的结果是一个表。我在index.php中的原始表使用数据表,样式和功能都非常完美。这里是我的index.php文件的一部分,它显示了从searchDate.php文件的结果中获得的结果:发件人:收件人:

            <select name="dateOption" id="dateOption">
                <option value="order"> Order </option>
                <option value="inventory"> Inventory </option>
                <option value="po"> PO# </option>
            </select>
            <input type="text" name="searchinput" id="searchinput" />
            <input type="button" value="SUBMIT" onclick="getDate();" />
        </form>

这里是getDate()函数:

function getDate() {
                $.post('searchDate.php' , {   dateKey: $("#searchinput").val(), 
                                              selected: $("#dateOption").val(),
                                              from: $("#date").val(),
                                              to: $("#date2").val()
                                              },
                    function(output) {
                        $('#mainTable').empty();
                        $('#orderSearch').empty();
                        $('#newOrder').empty();
                        $(".line").hide();
                        $("#loadNewInvoice").hide();
                        $('#searchResult').append(output);
                        $('#searchResult').css('display','block');
                        $('#searchResult').show("blind");
                });
            }

结果是一个与我原来的工作表具有相同id和类的表。然而,结果不是功能性的,也没有风格。提前谢谢。编辑:这是css和我的数据表配置,以防万一:

table.display {
margin: 0 auto;
clear: both;
width: 100%;

}
table.display thead th {
padding: 3px 18px 3px 10px;
border-bottom: 1px solid black;
font-weight: bold;
cursor: pointer;
* cursor: hand;
}
table.display tfoot th {
padding: 3px 18px 3px 10px;
border-top: 1px solid black;
font-weight: bold;
}
table.display tr.heading2 td {
border-bottom: 1px solid #aaa;
}
table.display td {
padding: 3px 10px;
}
table.display td.center {
text-align: center;
 }

数据表:

$(document).ready( function () {
var oTable = $('#theTable').dataTable({
"bPaginate": true,
"bScrollCollapse": true,
"iDisplayLength": 15,
"oLanguage": {
        "sSearch": "Search all columns:"
    },
"aoColumnDefs": [
  { "asSorting": [ "desc" ], "aTargets": [ 0 ] }
    ]
} );

我以前也遇到过同样的问题。Jquery要求您的所有id在页面中都是唯一的。如果这条规则得不到遵守,它根本不起作用!

因此,如果您更改了表的id,那么您的代码应该可以按预期工作。