I need Server-side processing in datatables
I need Server-side processing in datatables
Periyasamy25
Posts: 13Questions: 0Answers: 0
I am using two dropdown for search.onchange of dropdown i am calling the ajax function to fetch the values from database based on dropdown values and displaying in table(datatable).So how to include side-side processing in my coding.
My Sample Coding is.
index.php:
val1
val2
val3
val4
$(".search").change(function()
{
var val1=$('#val1').val();
var val2=$('#val2').val();
$.ajax(
{
url: 'table.php',
type: "get",
data: "val1="+val1+"&val2="+val2,
success: function(resp)
{
$("#table").html(resp);
var oTable = $('#example').dataTable(
{
"bProcessing": true,
"bJQueryUI": true,
"bDeferRender": true,
"oLanguage": {
"sSearch": 'Search rows:',
"sLengthMenu": "Display _MENU_ rows",
"sInfo": "Showing _START_ to _END_ of _TOTAL_ rows",
"sInfoEmpty": "Showing 0 to 0 of _TOTAL_ rows",
"sInfoFiltered": "(filtered from _MAX_ total rows)",
"sZeroRecords": "No rows available in table",
},
"aLengthMenu": [[10, 25, 50, 100, 200, 300], [10, 25, 50, 100, 200, 300]],
"sDom": 'lf rr pi rt pi',
});
}
});
My Sample Coding is.
index.php:
val1
val2
val3
val4
$(".search").change(function()
{
var val1=$('#val1').val();
var val2=$('#val2').val();
$.ajax(
{
url: 'table.php',
type: "get",
data: "val1="+val1+"&val2="+val2,
success: function(resp)
{
$("#table").html(resp);
var oTable = $('#example').dataTable(
{
"bProcessing": true,
"bJQueryUI": true,
"bDeferRender": true,
"oLanguage": {
"sSearch": 'Search rows:',
"sLengthMenu": "Display _MENU_ rows",
"sInfo": "Showing _START_ to _END_ of _TOTAL_ rows",
"sInfoEmpty": "Showing 0 to 0 of _TOTAL_ rows",
"sInfoFiltered": "(filtered from _MAX_ total rows)",
"sZeroRecords": "No rows available in table",
},
"aLengthMenu": [[10, 25, 50, 100, 200, 300], [10, 25, 50, 100, 200, 300]],
"sDom": 'lf rr pi rt pi',
});
}
});
This discussion has been closed.
Replies
Allan