0

我做了一个 ajax 请求,它返回一个 html 表。当我只是将位置重定向到该页面时,表格会正确显示,但是当我将 ajax 响应放在 div 元素中时,表格会变形。

function submitQuery() {
  length = category_query.length;
  if(category_query.indexOf('ALL') != -1)
    category_query = category_query.substring(0,length-4);    
  xmlhttp.onreadystatechange=function() {
    if(xmlhttp.readyState==4 && xmlhttp.status==200)
      document.getElementById('resultDiv1').innerHTML = xmlhttp.responseText;
  } 
  xmlhttp.open("GET","cons_query.php?q="+category_query,true);
  xmlhttp.send();
  //window.location="cons_query.php?q="+category_query;
  //if i just redirect to this location, the table is displayed fine.
}

我希望表格看起来像通过 ajax 一样。

4

1 回答 1

0

嗯...看起来您正在浮动响应页面左侧的行元素。只需从 css 中删除该格式它应该看起来像这样 td { width: <>px; 向左飘浮; }

于 2012-07-09T07:32:42.907 回答