Function to process before ajax and disable ajax for a condition

Function to process before ajax and disable ajax for a condition

mt.michael.cheungmt.michael.cheung Posts: 1Questions: 1Answers: 0

I'm using Jquery DataTable 1.10.15 and here's my data table. I want to check when a user click on each page that page's record reached an amount and if it does I want to pop up saying narrow down your search instead of displaying the page they want which means no ajax call/table load. The below code worked on the alert but when I return false I thought it will not do the ajax call but it still does. Anyone know how to do it?

var myTable = $('#myTable')
.on('preXhr.dt', function ( e, settings, data ) {
if (data.start + data.length >=10000) {
alert('here');
return false;
}
})
.DataTable({
searching: true,
processing: false,
serverSide: true,
columns: columnsList,
pageLength: 25,
ajax: {
.....

This discussion has been closed.