Ajax actions not working with jquery 1.9
Ajax actions not working with jquery 1.9
Shafraz
Posts: 2Questions: 0Answers: 0
Hi,
I use php code for generated table rows to work with DataTable. There i have an tag in each row where on click on them an ajax action triggered. But this ajax action only work on the first set of record, if i go to page number 2 its not working.
[code]
$(document).ready(function() {
oTable = $('#dtplugin').dataTable({
"oLanguage": {
"sSearch": ""
},
"aoColumnDefs": [{
"bSortable": false,
"aTargets": [3]
}]
});
});
[/code]
Any help on this will be appreciated.
Thanks
I use php code for generated table rows to work with DataTable. There i have an tag in each row where on click on them an ajax action triggered. But this ajax action only work on the first set of record, if i go to page number 2 its not working.
[code]
$(document).ready(function() {
oTable = $('#dtplugin').dataTable({
"oLanguage": {
"sSearch": ""
},
"aoColumnDefs": [{
"bSortable": false,
"aTargets": [3]
}]
});
});
[/code]
Any help on this will be appreciated.
Thanks
This discussion has been closed.
Replies
The likely scenario is that your listener is the cell itself, using something like this:
[code]
$('td:eq(3)').click(function() { /* some function */ });
[/code]
...fired from the document ready function or a "run one time" script of some sort. The way to persist a listener is to bind it to an ancestor element that never gets destroyed. As a simple example, let's imagine my entire content area is inside a div with the ID "main". The listener would then be something like:
[code]
$('#main').on('click', '#someTable td:eq(3)', function() { /* some function */ });
[/code]
You can look up documentation for jQuery's ".on()" function for more information on event delegation.