using json receive No data available in table
using json receive No data available in table
in asp.net i have a method to get values from datatable and i get this result
{"data":[{"no":"3110001","nome":"2M - COMÉRCIO E SERVIÇOS DE ELETRICIDADE, LDA."},
{"no":"3110001","nome":"2M - COMÉRCIO E SERVIÇOS DE ELETRICIDADE, LDA."},
{"no":"3110001","nome":"2M - COMÉRCIO E SERVIÇOS DE ELETRICIDADE, LDA."},
{"no":"3110001","nome":"2M - COMÉRCIO E SERVIÇOS DE ELETRICIDADE, LDA."}]}
I created datatables
var table = $('#docvencidos').DataTable({
"ajax": {
type: "POST",
url: "WebForm4.aspx/getdocs",
"dataSrc": "",
contentType: "application/json; charset=utf-8",
dataType: 'json'
},
'columns': [
{'data': 'no' },
{'data': 'nome'},
],
'select': {
'style': 'multi'
},
'order': [[1, 'asc']]
});
Why i receive a message in table "No data availiable in table"
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You are returning the row data in the
dataobject which is the default place that Datatables looks for the data. But you are settingajax.dataSrcto a different location,"dataSrc": "",, so removing that option should load the table.Kevin
tanks Kevin