【问题标题】:Table height issue ajax表格高度问题ajax
【发布时间】:2017-02-05 23:13:13
【问题描述】:

尝试在 table_details.php 中打印一个宽度为 100%、高度为 100% 的表格

<table width="100%" height="100%" border="1" style="text-align:center">
<tr>
<td>1</td><td>2</td>
</tr>
<tr>
<td>3</td><td>4</td>
</tr>
</table>

它的工作正常:

但是当我尝试通过 ajax 页面打印表格时,例如从 table.php 调用 table_details.php。

table.php

<script>
$(function(){
  var key_val = 'test';
  var dataString = 'key_val=' + key_val;
  $.ajax({
    type: "GET",
    url: "table_details.php",
    data: dataString,
    cache: false,
    success: function(html) {
        alert(html);
        $('body').html(html);
    }
  });
});
</script>
</head>

<body>

</body>

</html>

但桌子不占高度。它的打印如下:

我的逻辑有什么问题?

【问题讨论】:

标签: php jquery html-table


【解决方案1】:

将高度100% 分配给您的bodyhtml

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-07-13
    • 1970-01-01
    • 2017-07-19
    • 2011-06-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多