I need to make an ajax call whenever the length selection is changed in datatables. I know how to make the ajax call, but I'm unsure how to bind it to the length select menu in datatables. What is the method for doing this?
Here is the code I used for anyone interested.
[code]
$('#myTable_length').change( function() {
var lengthVal = $('#myTable_length:selected').val();
$.post("ajax.cfm", { displayLength: lengthVal } );
} );
[/code]
This will bind to the change event of the length dropdown and post a request via ajax. It took some playing with, but I'm learning!
Replies
[code]
$('#myTable_length').change( function() {
var lengthVal = $('#myTable_length:selected').val();
$.post("ajax.cfm", { displayLength: lengthVal } );
} );
[/code]
This will bind to the change event of the length dropdown and post a request via ajax. It took some playing with, but I'm learning!