Pipelined Ajax and Changing URL
Pipelined Ajax and Changing URL
Hi I am using the pipelined ajax to return multiple pages, and would like change the url and also have it return multiple pages.
I am using the code here: https://datatables.net/examples/server_side/pipeline.html. So the processing is server side and 5 pages are returned for each Ajax request.
//copied from pipeline documentation
$.fn.dataTable.pipeline = function ( opts ) { ... }
$(document).ready(function() {
var example = $('#example').DataTable( {
"processing": true,
"serverSide": true,
"ajax": $.fn.dataTable.pipeline( {
url: 'scripts/server_processing.php',
pages: 5 // number of pages to cache
} )
} );
} );
Initial load returns 5 pages. I would like to have a button that when clicked, changes the ajax url.
$('#myButton').on('click', function() {
if(example.ajax.url() != 'scripts/secondary_server_processing.php') {
tblSublist.clearPipeline();
tblSublist.ajax.url('scripts/secondary_server_processing.php').load();
}
This works but only returns 1 page, not 5 pages. When debugging, the $.fn.dataTable.pipeline code is not being executed.
Answers
Resolved: The url value needs to be the entire pipeline function, not just the 'url' that you want