I have an ajax function whose response is in the form of html and has the following contents.
<tr><td>data1</td>td>data1</td>td>data3</td></tr>
Is it possible to add the response to dataTable row like this
$.ajax({
type:"POST",
url:myurl,
data:myformdata,
cache: false,
contentType: false,
processData: false,
success:function(hasil){
if($.parseHTML(hasil))
{
if($(hasil).filter('table').length)
{
$('#lstNews').DataTable().row.
add($(hasil).filter('table').html()).draw();
}
}
});
In the google I have found that I need to make the response to the following format for adding it to dataTable
$('#lstNews').DataTable().row.add(
[[ "data1", "data2","data3" ]
]
).draw();
Please help me