Hi everyone,
I have a jquery post like following, and which updates my existing datatable directly by injecting the data into the DOM like following:
$.post("/SearchCompetitor/Index", { username: _username }, StartLoading())
.done(function (data) {
if (data !== "UsernameError") {
var dbtb = $('<table />').append(data).find('#datatable-responsive').html();
$('#datatable-responsive').html(dbtb);
$('#datatable-responsive').dataTable({
"bDestroy": true
});
// This is where I re-create the table to display the data
}
else {
StopLoading();
ShowMessage("No user was found under: " + $('.txtSearch').val());
}
})
The "data" object holds the HTML of the table and what I'm trying to figure out here is how to pass the data directly into the datatable, instead of directly injecting it into the DOM like I'm doing right now:
var dbtb = $('<table />').append(data).find('#datatable-responsive').html();
$('#datatable-responsive').html(dbtb);
So my questions are:
- How to convert a C# List into a DBTable JSon acceptable format
- How to fill the data directly into the dbtable,without first injecting it into the DOM of the browser
Can someone help me out with this please?