How to send parameter prior to ajax in datatable?
How to send parameter prior to ajax in datatable?
mastersuse
Posts: 61Questions: 28Answers: 0
I want to send some parameter with POST method prior to send to datatables ajax. How to do that?
this is the sample of parameter that require to be send prior ajax
{
"uid": "4",
"tokenid": "abc123",
"item": "user",
"action": "read",
"type": "1",
"keyword": ""
}
$('#testTable').DataTable({
ajax: {
url: api_url',
crossDomain : true,
type : "POST",
cache : false,
dataType : "json",
contentType: "application/json",
dataSrc : "data",
},
columns: [
{ data : "fullname" },
{ data : "userid" },
{ data : "level" }
],
});
This discussion has been closed.
Answers
Check the jQuery ajax documentation for this please:
https://api.jquery.com/jquery.ajax/