Hi,
I need to POST with KTDatatable, but my backend is expecting a CSRF_TOKEN. How do I include this?
```
ReferenceError: Can't find variable: CSRF_TOKEN
```
Hi
Actually, we have stopped support for the KTDatatable. In Metronic v8+, the Datatatables.net plugin is fully used which has more great features. It would be good if you could consider moving forward to use Datatatables.net instead of KTDatatable.
Datatables.net plugin has this feature to support CSRF_TOKEN and POST methods.
Thanks
does not work for me:
var datatable = $("#table").KTDatatable({
data: {
type: "remote",
source: {
read: {
url: "/myurl/",
data: {
_token: CSRF_TOKEN,
},
method: "POST",
map: function (raw) {
var dataSet = raw;
if (typeof raw.data !== "undefined") {
dataSet = raw.data;
}
return dataSet;
},
},
},
Hi,
In the data.source.read config, could you please try to add _token value?
read: {
url: HOST_URL + "/api/datatables/demos/orders.php",
data: {
_token: "token-value"
}
},
Hi,
May I know which Metronic version are you using?
Regards