DataTable 1.10 - How to pass Datatable contents to Java (server side) using JQuery in JSON format
DataTable 1.10 - How to pass Datatable contents to Java (server side) using JQuery in JSON format
surip1980
Posts: 7Questions: 3Answers: 0
I have created a DataTable and I want to pass the contents of the table to Action method in JSON format.
Can you guide me how to pass DataTable contents as JSON data to server side Action method.
var selectedTable = $('#selected_table').DataTable(
{
"columns" : [
{ "mData" : "id"},
{ "mData" : "plugin_name"},
{ "mData" : "plugin_rule_key"},
{ "mData" : "name"},
{ "mData" : "priority"}
]
});
$('#createprofile').click(function(e) {
e.preventDefault();
var value1 = 'language='
+ $("#language").val() + '&Profilename='
+ $("#Profilename").val() +"&";
var tabledata = selectedTable.fnGetData(); // This doesnt worked
var data = tabledata+value1;
var jsondata = JSON.stringify(data);
$.ajax({url : "createprofile.action",
data : jsondata,
type : "POST",
dataType : 'json',
cache : false
})
.done(function(data,
textStatus,
jqXHR) {
alert("success");
});
});
Thanks
Sam
This discussion has been closed.