简体   繁体   中英

Ajax call not working on datatable after pagination in Laravel

I'm Using Ajax to Activate my registered users on my system and It works fine but only in first page of dataTables. when i'm to call another ajax request it does nothing.

Here is my Ajax code

$(document).ready(function(){
    // User Activate            
    $('.isActive').on('ifClicked', function(event){
        id = $(this).data('id');
            $.ajax({
                type: 'POST',
                url: SITE_URL + '/userActivate',

                data: {
                    '_token': $('input[name=_token]').val(),
                    'id': id
                },

                success: function(data) {

                toastr.success('Status Successfully Changed ! ', 'Congratulations', {timeOut: 5000});

                },

                error: function (jqXHR, exception) {    
                    console.log(jqXHR);
                    toastr.error('Something Error !', 'Status not Changed!')
                },
            });
            });

            $('.isActive').on('ifToggled', function(event) {
                      $(this).closest('tr').toggleClass('warning');
            });
 });

您能说得更具体些吗,以便在分页后的ajax调用中容易理解问题所在。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM