DataTables not working

DataTables not working

pew007pew007 Posts: 1Questions: 0Answers: 0
edited May 2013 in General
index.html
[code]





id
date
location



1
05/01/2013
SF


2
05/01/2013
SF


3
05/01/2013
SF


4
05/01/2013
SF


5
05/01/2013
SF














window.onload = function(){
$.post('sql.php', function (output) {
$('#result').html(output).show();
}).fail(function () { console.log('fail')});
};

$(document).ready(function(){
$('#result_table').dataTable();
});

$(document).ready(function(){
$('#example').dataTable();
});

[/code]

sql.php
[code]
<?php
$connection = SQL_connection;
$row = some sql query;
writeTable($row);

function writeTable($row){ ?>




ID
Date
Location
Status
Summary





<?php
foreach ($row as $row) { ?>
<?= $row['id'] ?>
<?= $row['date'] ?>
<?= $row['location'] ?>
<?= $row['status'] ?>
<?= $row['summary'] ?>">

<?php } ?>




<?php }
[/code]

#result is an empty div where I want to show the result_table after running a mysql query (done in sql.php). however, result_table is not converted to a DataTable. the #example table is a table I created in my html to test if DataTable is working, and it is. can someone help me please?

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Please see: http://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read
This discussion has been closed.