DataTables -> SQL Querry ->Array -> Add to DataTables
DataTables -> SQL Querry ->Array -> Add to DataTables
M4D1S0N
Posts: 2Questions: 1Answers: 0
Hello,
I get an Array from a mySQL querry. Here is an example:
Array
(
[0] => Array
(
[it_ip] => 192.168.0.100
[it_name] => FUJITSU PRIMERGY TX200 S7
[it_intname] => SERVER
)
)
Other Arrays are filled with 10+ results.
Now I want to add this into my DataTable.
Code-Snippet:
$.ajax({
type:'POST',
url:'index.php',
data: { action: 'it_ipaddresses_select', id: id },
success: (function(data) {
alert(data);
}), });
return false;
Can anyone help me to fill the DataTable "#dt" with the results from the arrray?
Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
Answers
Since you are making your own Ajax call to get the data, rather than using DataTables'
ajax
option, use therows.add()
method to add the rows. e.g.Make sure you set up the columns to expect the property names as you require. See this part of the documentation for details.
Allan
ok. Thx