Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81728

Unable to make a service call to server side

$
0
0

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

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.


Viewing all articles
Browse latest Browse all 81728

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>