Ajax data parameters not working
Ajax data parameters not working
victorc218
Posts: 4Questions: 2Answers: 0
I'm trying to populate a datatable with server side processing and have set the serverSide option to true with the following ajax configuration.
ajax: {
url: 'get-data',
type: 'get',
contentType: "application/json",
dataSrc: function(d) {
return d.data;
},
error: function(jqXHR, textStatus, errorThrown) {
console.log(jqXHR, textStatus, errorThrown);
},
},
However, the only input my get-data API receives is {"\/get-data":null}. I'm not sure what I'm doing wrong as I thought there should be a number of automatic sent parameters including "start" and "length". Does anyone know what I'm doing wrong? Any help is much appreciated! Thanks in advance!
This discussion has been closed.
Answers
The first thing to do is to remove the
dataSrc
option. That won't work with server-side processing since it would only return the array of data, but server-side processing needs more than that.Aside from that your
get-data
URL should be getting a lot of query string (GET) parameters sent to it. If that isn't happening I would need a link to a test case showing the issue.Allan