I do an ajax request which returns a html table. When I just do a location redirect to that page the table is displayed properly but when I put the ajax response inside a div element, the table goes out of shape.
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.
}
I want the table to look as it is even through ajax.
Hmm… looks like you are floating the row elements left side in your response page.
Just remove that formatting from css
It should look something like this
td { width: <>px; float: left; }