$.ajax({
type: "POST",
url: "EmpService.asmx/GetEmployeeDetails",
data: "",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (
$("#grid").kendoGrid({
dataSource: {
data: result.d
},
schema:{
data: "d"
},
columns: [{
field: "EMP_NAME",
title: "First Name"
},
{
field: "EMP_ID",
title: "ID"
}],
});
},
error: function (r) {
alert(r.responseText);
},
failure: function (r) {
alert(r.responseText);
}
});
});
I calling a service using ajax call and returning a json data and I am trying to bind to it Kendo grid, but it's not binding. I have the json data returned from the service in the below format
[{"EMP_NAME":"E1","EMP_ID":1},{"EMP_NAME":"E2","EMP_ID":2},{"EMP_NAME":"E3","EMP_ID":3}]
but when I am trying in harcoded way like below the grid shows the details
dataSource: {
data: [{"EMP_NAME":"E1","EMP_ID":1},{"EMP_NAME":"E2","EMP_ID":2},{"EMP_NAME":"E3","EMP_ID":3}]
},