Unable to make a service call to server side
Unable to make a service call to server side

Javascript
$('#grid').DataTable({
"processing": true,
"destroy": true,
"scrollY": true,
"scrollX": true,
"serverSide": true,
"paging": true,
"pageLength": 20,
"lengthChange": false,
"language": { search: '', searchPlaceholder: "Search..." },
"ajax":
{
"url":'api/Default/EmployeeDetails',
"contentType": "application/json",
"type": 'POST',
"dataType": "json",
"data": function (d) {
debugger;
return JSON.stringify(d);
},
"dataSrc": function (json) {
debugger;
//json.draw = json.draw;
//json.recordsTotal = json.recordsTotal;
//json.recordsFiltered = json.recordsFiltered;
//json.data = json.data;
var return_data = json;
//return return_data.data;
var dttt = $.parseJSON(return_data.data);
return dttt;
}
},
"columns": [
{
"data": "UserName",
"title": "Employee Name"
},
{
"data": "Password",
"title": "Passwords"
}, ]
HTML
<table id="grid" class="display" style="width:100% !important;height:50%">
</table>
Server side
[HttpPost("EmployeeDetails")]
public string EmployeeDetails([FromBody] PagingParams data)
{
SQLServerConnect connection = new SQLServerConnect();
string result = JsonConvert.SerializeObject(connection.EmployeeDetails("Employee", data));
return result;
}
I am unable to hit the service call. Ajax call not initializing. There is no error in console also.
Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This discussion has been closed.
Answers
If you check the developer's tools network tab, are you seeing the ajax request being made?
Colin
No.
Have you traced through the Javascript to make sure the Datatables init code you have above is executed?
There is nothing obvious from the code snippet to suggest why an Ajax request would be sent. Please post a link to your page or a test case showing the error so we can help debug.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin