$('#table1').DataTable({
"ajax": {
"url": "http://localhost:3000/mydata",
"type": "GET",
"dataSrc": "mydata", // add this to your ajax mehtod see example
"columns": [{
data: "MyID"
},
{
data: "MyType"
}
]
}
});
//Example: Json response from api call
[
mydata:[
{},
{}
]
]
//Data Table
ajax: {
url:"/dummyData.txt",
"dataSrc":'' // if data source is empty
},
//Example: empty data response from api call
[
{},{}
]