Using ajax.dataSrc Option always results `No matching records found`
Using ajax.dataSrc Option always results `No matching records found`
Dear Admin,
Currently, I have two projects. Let's say project A and B. Project A, it uses PHP as the server side and works fine. Project B, it uses ASP.NET and unfortunately it doesn't work properly especially at the ajax part.
I found from this discussion that for ASP.NET, the server is responding with a single parameter in the JSON object called d
. I'm aware of this and therefore as you suggested in that discussion I use ajax.dataSrc
in order to alter the response.
However, It turns out that when I implement that in Project B, it shows No matching records found
. Here is the code:
dataTable: {
ajax: {
type: 'POST',
url: window.location.href + '/GetData',
contentType: 'application/json; charset=utf-8',
dataType: 'json',
dataSrc: function (json) {
return $.parseJSON(json.d);
}
}
Even when I try to implement a simple followed code to Project A (the one that works well), it turns out to show No matching records found
as well:
dataSrc: function (json) {
return json;
}
Do you have any idea regarding this?