I am trying to parse a response data as html format. The data contains multiple tables (not nested tables). I load the html with ajax and trying to loop through the data with jquery. The problem is No result when I start with 'table' for looping (I have multiple tables and have no ID for the table.) When I use 'tr' It works well in firefox and chrome but not in IE. I would like to know how I can loop through these tables. Here is the code I was trying.
<html>
<head>
<title>Html table tParser</title>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script language="JavaScript">
$(document).ready(function(){
$.ajax({
url: "htmltables.html",
cache: false,
success: function(html)
{
//alert( (html.length));
//alert( $(html).find('table').size() );
$(html).find('table').each(function(index)
{
document.write('<br />'+'<br />'+ 'Table:' + index + '<br />')
$(this).find('tr').each(function(index) {
document.write('<br />'+'<br />'+ 'Row :' + index + '<br />');
$(this).find('td').each(function(index) {
document.write($(this).text() + '<br />');
}); //td
}); //tr
}); //table
} //success
}); // $.ajax(
});//$(document).ready(function
</script>
</head>
<body>
</body>
</html>
/*------------------------------ */
/* Here is the sample html file I was trying to parse*/
<html>
<head>
<title></title>
</head>
<body>
<table width="200" border="1">
<tr>
<td>1</td>
<td>1</td>
<td>1</td>
</tr>
<tr>
<td>2</td>
<td>2</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>3</td>
<td>3</td>
</tr>
</table>
<table width="200" border="1">
<tr>
<td>4</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>5</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>6</td>
<td>4</td>
<td>5</td>
</tr>
</table>
</body>
</html>