How can I fix TypeError: i is undefined?
How can I fix TypeError: i is undefined?
spartan2276
Posts: 5Questions: 2Answers: 0
I keep getting a "TypeError: i is undefined" error(datatables.min.js:36:271). I using datatables with php. PHP outputs my data to the table.
<script>
$(document).ready(function() {
$('#tiles').DataTable( {
order: [[ 2, 'asc' ], [ 0, 'asc' ]]
} );
});
</script>
PHP Code
<?php foreach ($results as $row) {
echo "<tr><td>".$row->id."</td>";
echo "<td><a href='#' onclick='modTile(".$row->id.");'>".$row->tile_name."</a></td>";
echo "<td>".$row->detail."</td>";
echo "<td><img src='wp-content/themes/orchid-new/assets/img/".$row->image."' width='138' height='80' style='border:1px solid #999;'/></td>";
echo "<td>".$row->providers."</td>";
echo "<td>".$row->states."</td>";
if ($row->occurring == '2'){
echo "<td class='txtalign'>Yes</td>";
} else {
echo "<td class='txtalign'>No</td>";
}
echo "<td title='Remove tile'><button type='button' class='delTile' onclick='DelTiles(".$row->id.");'><i class='material-icons'>delete_forever</i></button></td></tr>";
}
?>
Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This discussion has been closed.
Answers
The HTML being generated looks suspect. I don't see a closing
</tr>
. Have you checked that it is valid HTML using the W3C validator?Allan