Datatables integration with C#.net webmethod
Datatables integration with C#.net webmethod
agailevictor
Posts: 1Questions: 1Answers: 0
Hi,
Im new to datatables. Im trying to integrate the same with C#.net. after reading about datatables i started coding. but the datatables is not populating
below is my code
<script type="text/javascript">
function datatable() {
$.ajax({
type: "Post",
url: "WebForm2.aspx/getdata",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
$('#sample_1').DataTable({
"aaData": JSON.parse(data.d),
"columns": [{ "data": "Name" }, { "data": "gender" }, { "data": "doj"}]
});
},
error: function (err) {
alert(err);
}
})
}
</script>
[WebMethod]
public static DataTable getdata()
{
bus_eleave bus = new bus_eleave();
DataTable dt = bus.getdata();
return dt;
}
Can anyone tell me where i'm doing wrong. I have been looking for a solution for the last two days . but im stuck in this case
here is the jsfiddle https://jsfiddle.net/Lehnkp5x/
This discussion has been closed.