How do you combine a Normal Ajax(post) call with Datatables function.
How do you combine a Normal Ajax(post) call with Datatables function.
belsarerohit81
Posts: 6Questions: 4Answers: 0
var sendData=$("#target").seralize(); //Serializing Form element values
var oTable = $('#example').dataTable({
"bJQueryUI": true,
"bProcessing": true,
"bServerSide": false,
"ajax": {
"url": "query.cfm",
"type":"post",
"data": sendData
// I am not able to send this "sendData" variable across to the url hence datatables do not load and once I remove this variable the datatables work just fine.
},
"aoColumns": [
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi belsarehit81,
The
ajax.data
property can be used as a function like so:Hope this helps,
Thanks for the Reply.
How will I access these Variables on server side?
They should be accessible like any other form post data.
e.g. if you named your custom property
extra_data
then that should be available from the form variables on the serverParams["extra_data"]
.Just to give you a generic example since I am unfamiliar with anything other than .NET/C#.
Yes.
True we can access the variables just like any other form post data.
I am using Coldfusion.
i was able to work this out by a slit change in your code.
"data": function(d) {
returns $("#target").serialize();
}
Working fine now!
Thanks Ashbjorn !
Always happy to help, glad to know my information has led to a solution.